Skip to content

Commit 20d3efb

Browse files
authored
Format files using DocumentFormat
1 parent a5a4e9b commit 20d3efb

32 files changed

+333
-340
lines changed

docs/make.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ makedocs(;
77
repo="https://github.com/julia-vscode/LanguageServer.jl/blob/{commit}{path}#L{line}",
88
sitename="LanguageServer.jl",
99
format=Documenter.HTML(;
10-
prettyurls=prettyurls = get(ENV, "CI", nothing) == "true",
10+
prettyurls=prettyurls = get(ENV, "CI", nothing) == "true"
1111
# canonical="https://www.julia-vscode.org/LanguageServer.jl",
1212
# assets=String[],
1313
),
1414
pages=[
1515
"Home" => "index.md",
1616
"Syntax Reference" => "syntax.md",
17-
],
17+
]
1818
)
1919

2020
deploydocs(;
21-
repo="github.com/julia-vscode/LanguageServer.jl",
21+
repo="github.com/julia-vscode/LanguageServer.jl"
2222
)

src/document.jl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ function get_offset(doc::Document, line::Integer, character::Integer)
7777
line_offsets = get_line_offsets(doc)
7878
io = IOBuffer(get_text(doc))
7979
try
80-
seek(io, line_offsets[line + 1])
80+
seek(io, line_offsets[line+1])
8181
while character > 0
8282
c = read(io, Char)
8383
character -= 1
@@ -113,9 +113,9 @@ function get_offset2(doc::Document, line::Integer, character::Integer, forgiving
113113
throw(LSOffsetError("get_offset2 crashed. More diagnostics:\nline=$line\nline_offsets='$line_offsets'"))
114114
end
115115

116-
line_offset = line_offsets[line + 1]
116+
line_offset = line_offsets[line+1]
117117

118-
next_line_offset = line + 1 < length(line_offsets) ? line_offsets[line + 2] : nextind(text, lastindex(text))
118+
next_line_offset = line + 1 < length(line_offsets) ? line_offsets[line+2] : nextind(text, lastindex(text))
119119

120120
pos = line_offset
121121

@@ -134,7 +134,7 @@ function get_offset2(doc::Document, line::Integer, character::Integer, forgiving
134134
pos = nextind(text, pos)
135135
end
136136

137-
return pos
137+
return pos
138138
end
139139

140140
# Note: to be removed
@@ -173,16 +173,16 @@ function get_line_offsets(doc::Document, force=false)
173173
doc._line_offsets = Int[0]
174174
text = get_text(doc)
175175
ind = firstindex(text)
176-
while ind <= lastindex(text)
176+
while ind <= lastindex(text)
177177
c = text[ind]
178178
nl = c == '\n' || c == '\r'
179-
if c == '\r' && ind + 1 <= lastindex(text) && text[ind + 1] == '\n'
179+
if c == '\r' && ind + 1 <= lastindex(text) && text[ind+1] == '\n'
180180
ind += 1
181181
end
182182
nl && push!(doc._line_offsets, ind)
183183
ind = nextind(text, ind)
184184
end
185-
end
185+
end
186186
return doc._line_offsets
187187
end
188188

@@ -191,10 +191,10 @@ function get_line_offsets2!(doc::Document, force=false)
191191
doc._line_offsets2 = Int[1]
192192
text = get_text(doc)
193193
ind = firstindex(text)
194-
while ind <= lastindex(text)
194+
while ind <= lastindex(text)
195195
c = text[ind]
196196
if c == '\n' || c == '\r'
197-
if c == '\r' && ind + 1 <= lastindex(text) && text[ind + 1] == '\n'
197+
if c == '\r' && ind + 1 <= lastindex(text) && text[ind+1] == '\n'
198198
ind += 1
199199
end
200200
push!(doc._line_offsets2, ind + 1)
@@ -214,12 +214,12 @@ function get_line_of(line_offsets::Vector{Int}, offset::Integer)
214214
else
215215
line = 1
216216
while line < nlines
217-
if line_offsets[line] <= offset < line_offsets[line + 1]
217+
if line_offsets[line] <= offset < line_offsets[line+1]
218218
break
219219
end
220220
line += 1
221221
end
222-
end
222+
end
223223
return line, line_offsets[line]
224224
end
225225

@@ -240,7 +240,7 @@ function get_position_at(doc::Document, offset::Integer)
240240
c = read(io, Char)
241241
character += 1
242242
if UInt32(c) >= 0x010000
243-
character += 1
243+
character += 1
244244
end
245245
end
246246
close(io)

src/extensions/messagedefs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
const julia_getModuleAt_request_type = JSONRPC.RequestType("julia/getModuleAt", VersionedTextDocumentPositionParams, String)
2-
const julia_getCurrentBlockRange_request_type = JSONRPC.RequestType("julia/getCurrentBlockRange", VersionedTextDocumentPositionParams, Tuple{Position, Position, Position})
2+
const julia_getCurrentBlockRange_request_type = JSONRPC.RequestType("julia/getCurrentBlockRange", VersionedTextDocumentPositionParams, Tuple{Position,Position,Position})
33
const julia_getDocAt_request_type = JSONRPC.RequestType("julia/getDocAt", VersionedTextDocumentPositionParams, String)
44
const julia_getDocFromWord_request_type = JSONRPC.RequestType("julia/getDocFromWord", NamedTuple{(:word,),Tuple{String}}, String)

src/languageserverinstance.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ mutable struct LanguageServerInstance
6363

6464
shutdown_requested::Bool
6565

66-
function LanguageServerInstance(pipe_in, pipe_out, env_path="", depot_path="", err_handler=nothing, symserver_store_path=nothing, download=true, symbolcache_upstream = nothing)
66+
function LanguageServerInstance(pipe_in, pipe_out, env_path="", depot_path="", err_handler=nothing, symserver_store_path=nothing, download=true, symbolcache_upstream=nothing)
6767
new(
6868
JSONRPC.JSONRPCEndpoint(pipe_in, pipe_out, err_handler),
6969
Set{String}(),
7070
Dict{URI2,Document}(),
7171
env_path,
7272
depot_path,
73-
SymbolServer.SymbolServerInstance(depot_path, symserver_store_path; symbolcache_upstream = symbolcache_upstream),
73+
SymbolServer.SymbolServerInstance(depot_path, symserver_store_path; symbolcache_upstream=symbolcache_upstream),
7474
Channel(Inf),
7575
StaticLint.ExternalEnv(deepcopy(SymbolServer.stdlibs), SymbolServer.collect_extended_methods(SymbolServer.stdlibs), collect(keys(SymbolServer.stdlibs))),
7676
Dict(),
@@ -179,7 +179,7 @@ function trigger_symbolstore_reload(server::LanguageServerInstance)
179179
ssi_ret, payload = SymbolServer.getstore(
180180
server.symbol_server,
181181
server.env_path,
182-
function (msg, percentage = missing)
182+
function (msg, percentage=missing)
183183
if server.clientcapability_window_workdoneprogress && server.current_symserver_progress_token !== nothing
184184
msg = ismissing(percentage) ? msg : string(msg, " ($percentage%)")
185185
JSONRPC.send(
@@ -193,7 +193,7 @@ function trigger_symbolstore_reload(server::LanguageServerInstance)
193193
end
194194
end,
195195
server.err_handler,
196-
download = server.symserver_use_download
196+
download=server.symserver_use_download
197197
)
198198

199199
server.number_of_outstanding_symserver_requests -= 1
@@ -269,7 +269,7 @@ function Base.run(server::LanguageServerInstance)
269269
@debug "LS: Starting client listener task."
270270
while true
271271
msg = JSONRPC.get_next_message(server.jr_endpoint)
272-
put!(server.combined_msg_queue, (type = :clientmsg, msg = msg))
272+
put!(server.combined_msg_queue, (type=:clientmsg, msg=msg))
273273
end
274274
catch err
275275
bt = catch_backtrace()
@@ -282,7 +282,7 @@ function Base.run(server::LanguageServerInstance)
282282
end
283283
finally
284284
if isopen(server.combined_msg_queue)
285-
put!(server.combined_msg_queue, (type = :close,))
285+
put!(server.combined_msg_queue, (type=:close,))
286286
close(server.combined_msg_queue)
287287
end
288288
@debug "LS: Client listener task done."
@@ -292,7 +292,7 @@ function Base.run(server::LanguageServerInstance)
292292
@debug "LS: Starting symbol server listener task."
293293
while true
294294
msg = take!(server.symbol_results_channel)
295-
put!(server.combined_msg_queue, (type = :symservmsg, msg = msg))
295+
put!(server.combined_msg_queue, (type=:symservmsg, msg=msg))
296296
end
297297
catch err
298298
bt = catch_backtrace()
@@ -305,7 +305,7 @@ function Base.run(server::LanguageServerInstance)
305305
end
306306
finally
307307
if isopen(server.combined_msg_queue)
308-
put!(server.combined_msg_queue, (type = :close,))
308+
put!(server.combined_msg_queue, (type=:close,))
309309
close(server.combined_msg_queue)
310310
end
311311
@debug "LS: Symbol server listener task done."

src/multienv.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const project_names = ("JuliaProject.toml", "Project.toml")
1010
const manifest_names = ("JuliaManifest.toml", "Manifest.toml")
1111

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

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

5454
isempty(parent_workspaceFolders) && return
5555
# arbitrarily pick one
@@ -94,11 +94,11 @@ function get_env_for_root(doc::Document, server::LanguageServerInstance)
9494
msg
9595
))
9696
end
97-
@error msg exception=(err, catch_backtrace())
97+
@error msg exception = (err, catch_backtrace())
9898
end
9999
end
100100

101-
function complete_dep_tree(uuid, env_manifest, alldeps = Dict{Base.UUID,Pkg.Types.PackageEntry}())
101+
function complete_dep_tree(uuid, env_manifest, alldeps=Dict{Base.UUID,Pkg.Types.PackageEntry}())
102102
haskey(alldeps, uuid) && return alldeps
103103
alldeps[uuid] = env_manifest[uuid]
104104
for dep_uuid in values(alldeps[uuid].deps)

src/protocol/basic.jl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ end
6363
##############################################################################
6464
# Diagnostics
6565
const DiagnosticSeverity = Int
66-
const DiagnosticSeverities = (Error = 1,
67-
Warning = 2,
68-
Information = 3,
69-
Hint = 4)
66+
const DiagnosticSeverities = (Error=1,
67+
Warning=2,
68+
Information=3,
69+
Hint=4)
7070

7171
const DiagnosticTag = Int
72-
const DiagnosticTags = (Unnecessary = 1,
73-
Deprecated = 2)
72+
const DiagnosticTags = (Unnecessary=1,
73+
Deprecated=2)
7474

7575
@dict_readable struct DiagnosticRelatedInformation
7676
location::Location
@@ -104,8 +104,8 @@ end
104104
##############################################################################
105105
# Markup
106106
const MarkupKind = String
107-
const MarkupKinds = (PlainText = "plaintext",
108-
Markdown = "markdown")
107+
const MarkupKinds = (PlainText="plaintext",
108+
Markdown="markdown")
109109

110110
mutable struct MarkupContent
111111
kind::MarkupKind
@@ -126,10 +126,10 @@ Base.hash(x::MarkedString) = hash(x.value) # for unique
126126
##############################################################################
127127
# Window
128128
const MessageType = Int
129-
const MessageTypes = (Error = 1,
130-
Warning = 2,
131-
Info = 3,
132-
Log = 4)
129+
const MessageTypes = (Error=1,
130+
Warning=2,
131+
Info=3,
132+
Log=4)
133133

134134
struct ShowMessageParams <: Outbound
135135
type::MessageType

src/protocol/completion.jl

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
11
const CompletionItemKind = Int
2-
const CompletionItemKinds = (Text = 1,
3-
Method = 2,
4-
Function = 3,
5-
Constructor = 4,
6-
Field = 5,
7-
Variable = 6,
8-
Class = 7,
9-
Interface = 8,
10-
Module = 9,
11-
Property = 10,
12-
Unit = 11,
13-
Value = 12,
14-
Enum = 13,
15-
Keyword = 14,
16-
Snippet = 15,
17-
Color = 16,
18-
File = 17,
19-
Reference = 18,
20-
Folder = 19,
21-
EnumMember = 20,
22-
Constant = 21,
23-
Struct = 22,
24-
Event = 23,
25-
Operator = 24,
26-
TypeParameter = 25)
2+
const CompletionItemKinds = (Text=1,
3+
Method=2,
4+
Function=3,
5+
Constructor=4,
6+
Field=5,
7+
Variable=6,
8+
Class=7,
9+
Interface=8,
10+
Module=9,
11+
Property=10,
12+
Unit=11,
13+
Value=12,
14+
Enum=13,
15+
Keyword=14,
16+
Snippet=15,
17+
Color=16,
18+
File=17,
19+
Reference=18,
20+
Folder=19,
21+
EnumMember=20,
22+
Constant=21,
23+
Struct=22,
24+
Event=23,
25+
Operator=24,
26+
TypeParameter=25)
2727

2828
const CompletionItemTag = Int
2929
const CompletionItemTags = (Deprecated = 1)
3030

3131
const CompletionTriggerKind = Int
32-
const CompletionTriggerKinds = (Invoked = 1,
33-
TriggerCharacter = 2,
34-
TriggerForIncompleteCompletion = 3)
32+
const CompletionTriggerKinds = (Invoked=1,
33+
TriggerCharacter=2,
34+
TriggerForIncompleteCompletion=3)
3535

3636
const InsertTextFormat = Int
37-
const InsertTextFormats = (PlainText = 1,
38-
Snippet = 2)
37+
const InsertTextFormats = (PlainText=1,
38+
Snippet=2)
3939

4040
@dict_readable struct CompletionTagClientCapabilities
4141
valueSet::Vector{CompletionItemTag}

src/protocol/configuration.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ end
3030
##############################################################################
3131
# File watching
3232
const FileChangeType = Int
33-
const FileChangeTypes = (Created = 1,
34-
Changed = 2,
35-
Deleted = 3)
33+
const FileChangeTypes = (Created=1,
34+
Changed=2,
35+
Deleted=3)
3636

3737
const WatchKind = Int
38-
const WatchKinds = (Create = 1,
39-
Change = 2,
40-
Delete = 4)
38+
const WatchKinds = (Create=1,
39+
Change=2,
40+
Delete=4)
4141

4242

4343
@dict_readable struct FileEvent

src/protocol/document.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ end
7676
textDocument::TextDocumentItem
7777
end
7878

79-
@dict_readable struct TextDocumentContentChangeEvent <: Outbound
79+
@dict_readable struct TextDocumentContentChangeEvent <: Outbound
8080
range::Union{Range,Missing}
8181
rangeLength::Union{Int,Missing}
8282
text::String
@@ -97,9 +97,9 @@ end
9797
end
9898

9999
const TextDocumentSaveReason = Int
100-
const TextDocumentSaveReasons = (Manual = 1,
101-
AfterDelay = 2,
102-
FocusOut = 3)
100+
const TextDocumentSaveReasons = (Manual=1,
101+
AfterDelay=2,
102+
FocusOut=3)
103103

104104
@dict_readable struct WillSaveTextDocumentParams
105105
textDocument::TextDocumentIdentifier

0 commit comments

Comments
 (0)