Skip to content

Commit

Permalink
Format files using DocumentFormat
Browse files Browse the repository at this point in the history
  • Loading branch information
davidanthoff authored and github-actions[bot] committed Dec 20, 2024
1 parent 2633b63 commit 9bce995
Show file tree
Hide file tree
Showing 35 changed files with 385 additions and 386 deletions.
2 changes: 1 addition & 1 deletion src/extensions/messagedefs.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const julia_getModuleAt_request_type = JSONRPC.RequestType("julia/getModuleAt", VersionedTextDocumentPositionParams, String)
const julia_getCurrentBlockRange_request_type = JSONRPC.RequestType("julia/getCurrentBlockRange", VersionedTextDocumentPositionParams, Tuple{Position, Position, Position})
const julia_getCurrentBlockRange_request_type = JSONRPC.RequestType("julia/getCurrentBlockRange", VersionedTextDocumentPositionParams, Tuple{Position,Position,Position})
const julia_getDocAt_request_type = JSONRPC.RequestType("julia/getDocAt", VersionedTextDocumentPositionParams, String)
const julia_getDocFromWord_request_type = JSONRPC.RequestType("julia/getDocFromWord", NamedTuple{(:word,),Tuple{String}}, String)
const textDocument_publishTests_notification_type = JSONRPC.NotificationType("julia/publishTests", PublishTestsParams)
Expand Down
18 changes: 9 additions & 9 deletions src/languageserverinstance.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ mutable struct LanguageServerInstance

_send_request_metrics::Bool

function LanguageServerInstance(@nospecialize(pipe_in), @nospecialize(pipe_out), env_path="", depot_path="", err_handler=nothing, symserver_store_path=nothing, download=true, symbolcache_upstream = nothing, julia_exe::Union{NamedTuple{(:path,:version),Tuple{String,VersionNumber}},Nothing}=nothing)
function LanguageServerInstance(@nospecialize(pipe_in), @nospecialize(pipe_out), env_path="", depot_path="", err_handler=nothing, symserver_store_path=nothing, download=true, symbolcache_upstream=nothing, julia_exe::Union{NamedTuple{(:path, :version),Tuple{String,VersionNumber}},Nothing}=nothing)
endpoint = JSONRPC.JSONRPCEndpoint(pipe_in, pipe_out, err_handler)
jw = JuliaWorkspace()
# if hasfield(typeof(jw.runtime), :performance_tracing_callback)
Expand Down Expand Up @@ -314,7 +314,7 @@ end
Run the language `server`.
"""
function Base.run(server::LanguageServerInstance; timings = [])
function Base.run(server::LanguageServerInstance; timings=[])
did_show_timer = Ref(false)
add_timer_message!(did_show_timer, timings, "LS startup started")

Expand All @@ -340,7 +340,7 @@ function Base.run(server::LanguageServerInstance; timings = [])
if server.err_handler !== nothing
server.err_handler(err, bt)
else
@warn "LS: An error occurred in the client listener task. This may be normal." exception=(err, bt)
@warn "LS: An error occurred in the client listener task. This may be normal." exception = (err, bt)
end
finally
if isopen(server.combined_msg_queue)
Expand All @@ -363,7 +363,7 @@ function Base.run(server::LanguageServerInstance; timings = [])
if server.err_handler !== nothing
server.err_handler(err, bt)
else
@error "LS: Queue op failed" ex=(err, bt)
@error "LS: Queue op failed" ex = (err, bt)
end
finally
if isopen(server.combined_msg_queue)
Expand Down Expand Up @@ -450,11 +450,11 @@ function Base.run(server::LanguageServerInstance; timings = [])
server.jr_endpoint,
telemetry_event_notification_type,
Dict(
"command" => "request_metric",
"operationId" => g_operationId[],
"name" => msg["method"],
"time" => start_time,
"duration" => duration)
"command" => "request_metric",
"operationId" => g_operationId[],
"name" => msg["method"],
"time" => start_time,
"duration" => duration)
)
end
elseif message.type == :symservmsg
Expand Down
8 changes: 4 additions & 4 deletions src/multienv.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const project_names = ("JuliaProject.toml", "Project.toml")
const manifest_names = ("JuliaManifest.toml", "Manifest.toml")

# return nothing or the project file at env
function env_file(env::String, names = project_names)::Union{Nothing,String}
function env_file(env::String, names=project_names)::Union{Nothing,String}
if isdir(env)
for proj in names
project_file = joinpath(env, proj)
Expand Down Expand Up @@ -49,7 +49,7 @@ function get_env_for_root(doc::Document, server::LanguageServerInstance)
(safe_isfile(env_proj_file) && safe_isfile(env_manifest_file)) || return

# Find which workspace folder the doc is in.
parent_workspaceFolders = sort(filter(f->startswith(doc._path, f), collect(server.workspaceFolders)), by = length, rev = true)
parent_workspaceFolders = sort(filter(f -> startswith(doc._path, f), collect(server.workspaceFolders)), by=length, rev=true)

isempty(parent_workspaceFolders) && return
# arbitrarily pick one
Expand Down Expand Up @@ -94,11 +94,11 @@ function get_env_for_root(doc::Document, server::LanguageServerInstance)
msg
))
end
@error msg exception=(err, catch_backtrace())
@error msg exception = (err, catch_backtrace())
end
end

function complete_dep_tree(uuid, env_manifest, alldeps = Dict{Base.UUID,Pkg.Types.PackageEntry}())
function complete_dep_tree(uuid, env_manifest, alldeps=Dict{Base.UUID,Pkg.Types.PackageEntry}())
haskey(alldeps, uuid) && return alldeps
alldeps[uuid] = env_manifest[uuid]
for dep_uuid in values(alldeps[uuid].deps)
Expand Down
24 changes: 12 additions & 12 deletions src/protocol/basic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ end
##############################################################################
# Diagnostics
const DiagnosticSeverity = Int
const DiagnosticSeverities = (Error = 1,
Warning = 2,
Information = 3,
Hint = 4)
const DiagnosticSeverities = (Error=1,
Warning=2,
Information=3,
Hint=4)

const DiagnosticTag = Int
const DiagnosticTags = (Unnecessary = 1,
Deprecated = 2)
const DiagnosticTags = (Unnecessary=1,
Deprecated=2)

@dict_readable struct DiagnosticRelatedInformation <: Outbound
location::Location
Expand Down Expand Up @@ -108,8 +108,8 @@ end
##############################################################################
# Markup
const MarkupKind = String
const MarkupKinds = (PlainText = "plaintext",
Markdown = "markdown")
const MarkupKinds = (PlainText="plaintext",
Markdown="markdown")

mutable struct MarkupContent
kind::MarkupKind
Expand All @@ -130,10 +130,10 @@ Base.hash(x::MarkedString) = hash(x.value) # for unique
##############################################################################
# Window
const MessageType = Int
const MessageTypes = (Error = 1,
Warning = 2,
Info = 3,
Log = 4)
const MessageTypes = (Error=1,
Warning=2,
Info=3,
Log=4)

struct ShowMessageParams <: Outbound
type::MessageType
Expand Down
60 changes: 30 additions & 30 deletions src/protocol/completion.jl
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
const CompletionItemKind = Int
const CompletionItemKinds = (Text = 1,
Method = 2,
Function = 3,
Constructor = 4,
Field = 5,
Variable = 6,
Class = 7,
Interface = 8,
Module = 9,
Property = 10,
Unit = 11,
Value = 12,
Enum = 13,
Keyword = 14,
Snippet = 15,
Color = 16,
File = 17,
Reference = 18,
Folder = 19,
EnumMember = 20,
Constant = 21,
Struct = 22,
Event = 23,
Operator = 24,
TypeParameter = 25)
const CompletionItemKinds = (Text=1,
Method=2,
Function=3,
Constructor=4,
Field=5,
Variable=6,
Class=7,
Interface=8,
Module=9,
Property=10,
Unit=11,
Value=12,
Enum=13,
Keyword=14,
Snippet=15,
Color=16,
File=17,
Reference=18,
Folder=19,
EnumMember=20,
Constant=21,
Struct=22,
Event=23,
Operator=24,
TypeParameter=25)

const CompletionItemTag = Int
const CompletionItemTags = (Deprecated = 1)

const CompletionTriggerKind = Int
const CompletionTriggerKinds = (Invoked = 1,
TriggerCharacter = 2,
TriggerForIncompleteCompletion = 3)
const CompletionTriggerKinds = (Invoked=1,
TriggerCharacter=2,
TriggerForIncompleteCompletion=3)

const InsertTextFormat = Int
const InsertTextFormats = (PlainText = 1,
Snippet = 2)
const InsertTextFormats = (PlainText=1,
Snippet=2)

@dict_readable struct CompletionTagClientCapabilities
valueSet::Vector{CompletionItemTag}
Expand Down
16 changes: 8 additions & 8 deletions src/protocol/configuration.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ end
##############################################################################
# File watching
const FileChangeType = Int
const FileChangeTypes = (Created = 1,
Changed = 2,
Deleted = 3)
const FileChangeTypes = (Created=1,
Changed=2,
Deleted=3)

const WatchKind = Int
const WatchKinds = (Create = 1,
Change = 2,
Delete = 4)
const WatchKinds = (Create=1,
Change=2,
Delete=4)


@dict_readable struct FileEvent
Expand All @@ -52,8 +52,8 @@ end
const Pattern = String

struct RelativePattern <: Outbound
baseUri::Union{WorkspaceFolder,URI}
pattern::Pattern
baseUri::Union{WorkspaceFolder,URI}
pattern::Pattern
end

const GlobPattern = Union{Pattern,RelativePattern}
Expand Down
8 changes: 4 additions & 4 deletions src/protocol/document.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ end
textDocument::TextDocumentItem
end

@dict_readable struct TextDocumentContentChangeEvent <: Outbound
@dict_readable struct TextDocumentContentChangeEvent <: Outbound
range::Union{Range,Missing}
rangeLength::Union{Int,Missing}
text::String
Expand All @@ -97,9 +97,9 @@ end
end

const TextDocumentSaveReason = Int
const TextDocumentSaveReasons = (Manual = 1,
AfterDelay = 2,
FocusOut = 3)
const TextDocumentSaveReasons = (Manual=1,
AfterDelay=2,
FocusOut=3)

@dict_readable struct WillSaveTextDocumentParams
textDocument::TextDocumentIdentifier
Expand Down
50 changes: 25 additions & 25 deletions src/protocol/features.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import Base.==
##############################################################################
# Code Action
const CodeActionKind = String
const CodeActionKinds = (Empty = "",
QuickFix = "quickfix",
Refactor = "refactor",
RefactorExtract = "refactor.extract",
RefactorInline = "refactor.inline",
RefactorRewrite = "refactor.rewrite",
Source = "source",
SourceOrganizeImports = "source.organizeImports")
const CodeActionKinds = (Empty="",
QuickFix="quickfix",
Refactor="refactor",
RefactorExtract="refactor.extract",
RefactorInline="refactor.inline",
RefactorRewrite="refactor.rewrite",
Source="source",
SourceOrganizeImports="source.organizeImports")

@dict_readable struct CodeActionKindCapabilities
valueSet::Vector{CodeActionKind}
Expand Down Expand Up @@ -211,9 +211,9 @@ end
##############################################################################
# Folding
const FoldingRangeKind = String
const FoldingRangeKinds = (Comment = "comment",
Imports = "imports",
Region = "region")
const FoldingRangeKinds = (Comment="comment",
Imports="imports",
Region="region")

@dict_readable struct FoldingRangeClientCapabilities <: Outbound
dynamicRegistration::Union{Bool,Missing}
Expand Down Expand Up @@ -306,8 +306,8 @@ end
@dict_readable struct InlayHintRegistrationOptions <: Outbound
workDoneToken::Union{Int,String,Missing} # ProgressToken
resolveProvider::Bool # InlayHintOptions
id::Union{Missing, String} # StaticRegistrationOptions
documentSelector::Union{Nothing, DocumentSelector} # TextDocumentRegistrationOptions
id::Union{Missing,String} # StaticRegistrationOptions
documentSelector::Union{Nothing,DocumentSelector} # TextDocumentRegistrationOptions
end

@dict_readable struct InlayHintParams <: Outbound
Expand All @@ -318,26 +318,26 @@ end

@dict_readable struct InlayHintLabelPart <: Outbound
value::String
tooltip::Union{Missing, String, MarkupContent}
location::Union{Missing, Location}
command::Union{Missing, Command}
tooltip::Union{Missing,String,MarkupContent}
location::Union{Missing,Location}
command::Union{Missing,Command}
end

const InlayHintKind = Int
const InlayHintKinds = (
Type = 1,
Parameter = 2
Type=1,
Parameter=2
)

@dict_readable struct InlayHint <: Outbound
position::Position
label::Union{String, Vector{InlayHintLabelPart}}
kind::Union{Missing, InlayHintKind}
textEdits::Union{Missing, Vector{TextEdit}}
tooltip::Union{Missing, String, MarkupContent}
paddingLeft::Union{Missing, Bool}
paddingRight::Union{Missing, Bool}
data::Union{Missing, Any}
label::Union{String,Vector{InlayHintLabelPart}}
kind::Union{Missing,InlayHintKind}
textEdits::Union{Missing,Vector{TextEdit}}
tooltip::Union{Missing,String,MarkupContent}
paddingLeft::Union{Missing,Bool}
paddingRight::Union{Missing,Bool}
data::Union{Missing,Any}
end

##############################################################################
Expand Down
2 changes: 1 addition & 1 deletion src/protocol/goto.jl
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,4 @@ end
workDoneToken::Union{Int,String,Missing} # ProgressToken
partialResultToken::Union{Int,String,Missing} # ProgressToken
context::ReferenceContext
end
end
8 changes: 4 additions & 4 deletions src/protocol/highlight.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const DocumentHighlightKind = Int
const DocumentHighlightKinds = (Text = 1,
Read = 2,
Write = 3)
const DocumentHighlightKinds = (Text=1,
Read=2,
Write=3)

@dict_readable struct DocumentHighlightClientCapabilities <: Outbound
dynamicRegistration::Union{Bool,Missing}
Expand All @@ -26,4 +26,4 @@ end
struct DocumentHighlight <: Outbound
range::Range
kind::Union{DocumentHighlightKind,Missing}
end
end
Loading

0 comments on commit 9bce995

Please sign in to comment.