Skip to content

Commit 4e5efaf

Browse files
authored
Format files using DocumentFormat
1 parent 512b05a commit 4e5efaf

36 files changed

Lines changed: 362 additions & 370 deletions

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/URIs2/URIs2.jl

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ end
1919
function URI(value::AbstractString)
2020
m = match(r"^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?", value)
2121

22-
m===nothing && error("Invalid argument.")
22+
m === nothing && error("Invalid argument.")
2323

2424
return URI(
2525
m.captures[2],
26-
m.captures[4]===nothing ? nothing : percent_decode(m.captures[4]),
27-
m.captures[5]===nothing ? nothing : percent_decode(m.captures[5]),
28-
m.captures[7]===nothing ? nothing : percent_decode(m.captures[7]),
29-
m.captures[9]===nothing ? nothing : percent_decode(m.captures[9])
26+
m.captures[4] === nothing ? nothing : percent_decode(m.captures[4]),
27+
m.captures[5] === nothing ? nothing : percent_decode(m.captures[5]),
28+
m.captures[7] === nothing ? nothing : percent_decode(m.captures[7]),
29+
m.captures[9] === nothing ? nothing : percent_decode(m.captures[9])
3030
)
3131
end
3232

@@ -38,58 +38,58 @@ function URI(;
3838
path::AbstractString="",
3939
query::Union{AbstractString,Nothing}=nothing,
4040
fragment::Union{AbstractString,Nothing}=nothing
41-
)
41+
)
4242
return URI(scheme, authority, path, query, fragment)
4343
end
4444

4545
@inline function is_rfc3986_unreserved(c::Char)
4646
return 'A' <= c <= 'Z' ||
47-
'a' <= c <= 'z' ||
48-
'0' <= c <= '9' ||
49-
c == '-' ||
50-
c == '.' ||
51-
c == '_' ||
52-
c == '~'
47+
'a' <= c <= 'z' ||
48+
'0' <= c <= '9' ||
49+
c == '-' ||
50+
c == '.' ||
51+
c == '_' ||
52+
c == '~'
5353
end
5454

5555
@inline function is_rfc3986_sub_delim(c::Char)
5656
return c == '!' ||
57-
c == '$' ||
58-
c == '&' ||
59-
c == '\'' ||
60-
c == '(' ||
61-
c == ')' ||
62-
c == '*' ||
63-
c == '+' ||
64-
c == ',' ||
65-
c == ';' ||
66-
c == '='
57+
c == '$' ||
58+
c == '&' ||
59+
c == '\'' ||
60+
c == '(' ||
61+
c == ')' ||
62+
c == '*' ||
63+
c == '+' ||
64+
c == ',' ||
65+
c == ';' ||
66+
c == '='
6767
end
6868

6969
@inline function is_rfc3986_pchar(c::Char)
7070
return is_rfc3986_unreserved(c) ||
71-
is_rfc3986_sub_delim(c) ||
72-
c == ':' ||
73-
c == '@'
71+
is_rfc3986_sub_delim(c) ||
72+
c == ':' ||
73+
c == '@'
7474
end
7575

7676
@inline function is_rfc3986_query(c::Char)
77-
return is_rfc3986_pchar(c) || c=='/' || c=='?'
77+
return is_rfc3986_pchar(c) || c == '/' || c == '?'
7878
end
7979

8080
@inline function is_rfc3986_fragment(c::Char)
81-
return is_rfc3986_pchar(c) || c=='/' || c=='?'
81+
return is_rfc3986_pchar(c) || c == '/' || c == '?'
8282
end
8383

8484
@inline function is_rfc3986_userinfo(c::Char)
8585
return is_rfc3986_unreserved(c) ||
86-
is_rfc3986_sub_delim(c) ||
87-
c == ':'
86+
is_rfc3986_sub_delim(c) ||
87+
c == ':'
8888
end
8989

9090
@inline function is_rfc3986_reg_name(c::Char)
9191
return is_rfc3986_unreserved(c) ||
92-
is_rfc3986_sub_delim(c)
92+
is_rfc3986_sub_delim(c)
9393
end
9494

9595
function encode(io::IO, s::AbstractString, issafe::Function)
@@ -104,14 +104,14 @@ function encode(io::IO, s::AbstractString, issafe::Function)
104104
end
105105

106106
@inline function is_ipv4address(s::AbstractString)
107-
if length(s)==1
107+
if length(s) == 1
108108
return '0' <= s[1] <= '9'
109-
elseif length(s)==2
109+
elseif length(s) == 2
110110
return '1' <= s[1] <= '9' && '0' <= s[2] <= '9'
111-
elseif length(s)==3
112-
return (s[1]=='1' && '0' <= s[2] <= '9' && '0' <= s[3] <= '9') ||
113-
(s[1]=='2' && '0' <= s[2] <= '4' && '0' <= s[3] <= '9') ||
114-
(s[1]=='2' && s[2] == '5' && '0' <= s[3] <= '5')
111+
elseif length(s) == 3
112+
return (s[1] == '1' && '0' <= s[2] <= '9' && '0' <= s[3] <= '9') ||
113+
(s[1] == '2' && '0' <= s[2] <= '4' && '0' <= s[3] <= '9') ||
114+
(s[1] == '2' && s[2] == '5' && '0' <= s[3] <= '5')
115115
else
116116
return false
117117
end
@@ -143,44 +143,44 @@ function Base.print(io::IO, uri::URI)
143143
query = uri.query
144144
fragment = uri.fragment
145145

146-
if scheme!==nothing
146+
if scheme !== nothing
147147
print(io, scheme)
148148
print(io, ':')
149-
end
149+
end
150150

151-
if authority!==nothing
151+
if authority !== nothing
152152
print(io, "//")
153153

154-
idx = findfirst("@", authority)
155-
if idx !== nothing
156-
# <user>@<auth>
157-
userinfo = SubString(authority, 1:idx.start-1)
158-
host_and_port = SubString(authority, idx.start + 1)
159-
encode(io, userinfo, is_rfc3986_userinfo)
154+
idx = findfirst("@", authority)
155+
if idx !== nothing
156+
# <user>@<auth>
157+
userinfo = SubString(authority, 1:idx.start-1)
158+
host_and_port = SubString(authority, idx.start + 1)
159+
encode(io, userinfo, is_rfc3986_userinfo)
160160
print(io, '@')
161161
else
162162
host_and_port = SubString(authority, 1)
163-
end
163+
end
164164

165-
idx3 = findfirst(":", host_and_port)
166-
if idx3 === nothing
165+
idx3 = findfirst(":", host_and_port)
166+
if idx3 === nothing
167167
encode_host(io, host_and_port)
168-
else
169-
# <auth>:<port>
168+
else
169+
# <auth>:<port>
170170
encode_host(io, SubString(host_and_port, 1:idx3.start-1))
171-
print(io, SubString(host_and_port, idx3.start))
171+
print(io, SubString(host_and_port, idx3.start))
172172
end
173-
end
173+
end
174174

175-
# Append path
176-
encode_path(io, path)
175+
# Append path
176+
encode_path(io, path)
177177

178-
if query!==nothing
178+
if query !== nothing
179179
print(io, '?')
180180
encode(io, query, is_rfc3986_query)
181181
end
182182

183-
if fragment!==nothing
183+
if fragment !== nothing
184184
print(io, '#')
185185
encode(io, fragment, is_rfc3986_fragment)
186186
end

src/URIs2/uri_helpers.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ function uri2filepath(uri::URI)
77
path = uri.path
88
host = uri.authority
99

10-
if host!==nothing && host != "" && length(path) > 1
10+
if host !== nothing && host != "" && length(path) > 1
1111
# unc path: file://shares/c$/far/boo
1212
value = "//$host$path"
1313
elseif length(path) >= 3 &&
14-
path[1] == '/' &&
15-
isascii(path[2]) && isletter(path[2]) &&
16-
path[3] == ':'
14+
path[1] == '/' &&
15+
isascii(path[2]) && isletter(path[2]) &&
16+
path[3] == ':'
1717
# windows drive letter: file:///c:/far/boo
1818
value = lowercase(path[2]) * path[3:end]
1919
else
@@ -42,14 +42,14 @@ function filepath2uri(path::String)
4242
if startswith(path, "//")
4343
# UNC path //foo/bar/foobar
4444
idx = findnext("/", path, 3)
45-
if idx===nothing
45+
if idx === nothing
4646
authority = path[3:end]
4747
path = "/"
4848
else
4949
authority = path[3:idx.start-1]
5050
path = path[idx.start:end]
5151
end
52-
elseif length(path)>=2 && isascii(path[1]) && isletter(path[1]) && path[2]==':'
52+
elseif length(path) >= 2 && isascii(path[1]) && isletter(path[1]) && path[2] == ':'
5353
path = string('/', lowercase(path[1]), SubString(path, 2))
5454
end
5555

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{URI,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
@@ -281,7 +281,7 @@ function Base.run(server::LanguageServerInstance)
281281
@debug "LS: Starting client listener task."
282282
while true
283283
msg = JSONRPC.get_next_message(server.jr_endpoint)
284-
put!(server.combined_msg_queue, (type = :clientmsg, msg = msg))
284+
put!(server.combined_msg_queue, (type=:clientmsg, msg=msg))
285285
end
286286
catch err
287287
bt = catch_backtrace()
@@ -294,7 +294,7 @@ function Base.run(server::LanguageServerInstance)
294294
end
295295
finally
296296
if isopen(server.combined_msg_queue)
297-
put!(server.combined_msg_queue, (type = :close,))
297+
put!(server.combined_msg_queue, (type=:close,))
298298
close(server.combined_msg_queue)
299299
end
300300
@debug "LS: Client listener task done."
@@ -304,7 +304,7 @@ function Base.run(server::LanguageServerInstance)
304304
@debug "LS: Starting symbol server listener task."
305305
while true
306306
msg = take!(server.symbol_results_channel)
307-
put!(server.combined_msg_queue, (type = :symservmsg, msg = msg))
307+
put!(server.combined_msg_queue, (type=:symservmsg, msg=msg))
308308
end
309309
catch err
310310
bt = catch_backtrace()
@@ -317,7 +317,7 @@ function Base.run(server::LanguageServerInstance)
317317
end
318318
finally
319319
if isopen(server.combined_msg_queue)
320-
put!(server.combined_msg_queue, (type = :close,))
320+
put!(server.combined_msg_queue, (type=:close,))
321321
close(server.combined_msg_queue)
322322
end
323323
@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)

0 commit comments

Comments
 (0)