Skip to content

Commit bc475c4

Browse files
committed
Fix completion kind for function arguments and local variables, fixes #872.
1 parent 5776c1f commit bc475c4

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/requests/completions.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,8 @@ function _completion_kind(b)
293293
return CompletionItemKinds.Value
294294
elseif b.type == StaticLint.CoreTypes.DataType
295295
return CompletionItemKinds.Struct
296+
elseif b.type === nothing || b.type isa SymbolServer.DataTypeStore
297+
return CompletionItemKinds.Variable
296298
else
297299
return CompletionItemKinds.Enum
298300
end

test/requests/completions.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,17 @@ end
133133
@test any(item.label == "βbb" for item in completion_test(4, 2).items)
134134
@test any(item.label == "bβb" for item in completion_test(5, 2).items)
135135
end
136+
137+
@testset "completion kinds" begin
138+
Kinds = LanguageServer.CompletionItemKinds
139+
# issue #872
140+
settestdoc("""
141+
function f(kind_variable_arg)
142+
kind_variable_local = 1
143+
kind_variable_
144+
end
145+
""")
146+
items = completion_test(2, 18).items
147+
@test any(i -> i.label == "kind_variable_local" && i.kind == Kinds.Variable, items)
148+
@test any(i -> i.label == "kind_variable_arg" && i.kind == Kinds.Variable, items)
149+
end

0 commit comments

Comments
 (0)