Skip to content

Commit 2d4c11a

Browse files
committed
fix
1 parent fa0839b commit 2d4c11a

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/requests/completions.jl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ function is_completion_match(s::AbstractString, prefix::AbstractString, cutoff=3
2929
end
3030

3131
function textDocument_completion_request(params::CompletionParams, server::LanguageServerInstance, conn)
32-
state = let
32+
state = let
3333
doc = getdocument(server, URI2(params.textDocument.uri))
3434
offset = get_offset(doc, params.position)
3535
rng = Range(doc, offset:offset)
3636
x = get_expr(getcst(doc), offset)
3737
using_stmts = server.completion_mode == :import ? get_preexisting_using_stmts(x, doc) : Dict()
3838
CompletionState(offset, CompletionItem[], rng, x, doc, server, using_stmts)
3939
end
40-
40+
4141
ppt, pt, t, is_at_end = get_partial_completion(state)
4242

4343
if pt isa CSTParser.Tokens.Token && pt.kind == CSTParser.Tokenize.Tokens.BACKSLASH
@@ -151,7 +151,7 @@ const snippet_completions = Dict{String,String}(
151151
function texteditfor(state::CompletionState, partial, n)
152152
TextEdit(Range(Position(state.range.start.line, state.range.start.character - sizeof(partial)), state.range.stop), n)
153153
end
154-
154+
155155
function collect_completions(m::SymbolServer.ModuleStore, spartial, state::CompletionState, inclexported=false, dotcomps=false)
156156
for val in m.vals
157157
n, v = String(val[1]), val[2]
@@ -167,7 +167,7 @@ function collect_completions(m::SymbolServer.ModuleStore, spartial, state::Compl
167167
push!(state.completions, CompletionItem(n, _completion_kind(v, state.server), MarkupContent(sanitize_docstring(v.doc)), texteditfor(state, spartial, string(m.name, ".", n))))
168168
elseif length(spartial) > 3 && !variable_already_imported(m, n, state)
169169
if state.server.completion_mode === :import
170-
# These are non-exported names and require the insertion of a :using statement.
170+
# These are non-exported names and require the insertion of a :using statement.
171171
# We need to insert this statement at the start of the current top-level scope (e.g. Main or a module) and tag it onto existing :using statements if possible.
172172
cmd = Command("Apply text edit", "language-julia.applytextedit", [
173173
WorkspaceEdit(missing, [textedit_to_insert_using_stmt(m, n, state)])
@@ -367,8 +367,8 @@ function path_completion(t, state::CompletionState)
367367
if isdir(joinpath(dir, f))
368368
f = string(f, "/")
369369
end
370-
rng1 = Range(doc, offset - sizeof(partial):offset)
371-
push!(CIs, CompletionItem(f, 17, f, TextEdit(rng1, f)))
370+
rng1 = Range(state.doc, state.offset - sizeof(partial):state.offset)
371+
push!(state.completions, CompletionItem(f, 17, f, TextEdit(rng1, f)))
372372
catch err
373373
isa(err, Base.IOError) || isa(err, Base.SystemError) || rethrow()
374374
end
@@ -447,8 +447,8 @@ function get_preexisting_using_stmts(x::EXPR, doc::Document)
447447
using_stmts = Dict{String,Any}()
448448
tls = StaticLint.retrieve_toplevel_scope(x)
449449
file_level_arg = get_file_level_parent(x)
450-
451-
if scopeof(getcst(doc)) == tls
450+
451+
if scopeof(getcst(doc)) == tls
452452
# check for :using stmts in current file
453453
for a in getcst(doc).args
454454
if headof(a) === :using
@@ -464,15 +464,15 @@ function get_preexisting_using_stmts(x::EXPR, doc::Document)
464464
if headof(a) === :using
465465
add_using_stmt(a, using_stmts)
466466
end
467-
467+
468468
end
469469
end
470470
return using_stmts
471471
end
472472

473473
function add_using_stmt(x::EXPR, using_stmts)
474474
if length(x.args) > 0 && CSTParser.is_colon(x.args[1].head)
475-
if CSTParser.is_dot(x.args[1].args[1].head) && length(x.args[1].args[1].args) == 1
475+
if CSTParser.is_dot(x.args[1].args[1].head) && length(x.args[1].args[1].args) == 1
476476
using_stmts[valof(x.args[1].args[1].args[1])] = (x, get_file_loc(x))
477477
end
478478
end
@@ -490,7 +490,7 @@ function textedit_to_insert_using_stmt(m::SymbolServer.ModuleStore, n::String, s
490490
tls = StaticLint.retrieve_toplevel_scope(state.x)
491491
if haskey(state.using_stmts, String(m.name.name))
492492
(using_stmt, (using_doc, using_offset)) = state.using_stmts[String(m.name.name)]
493-
493+
494494
l, c = get_position_at(using_doc, using_offset + using_stmt.span)
495495
TextDocumentEdit(VersionedTextDocumentIdentifier(using_doc._uri, using_doc._version),
496496
[TextEdit(Range(l, c, l, c), ", $n")])

0 commit comments

Comments
 (0)