diff options
-rw-r--r-- | server/src/core/find_source.lua | 4 | ||||
-rw-r--r-- | server/test/completion/init.lua | 30 |
2 files changed, 33 insertions, 1 deletions
diff --git a/server/src/core/find_source.lua b/server/src/core/find_source.lua index cac3a263..a64a047e 100644 --- a/server/src/core/find_source.lua +++ b/server/src/core/find_source.lua @@ -39,8 +39,10 @@ local function findAtPos(vm, pos, filter) if rangeA == rangeB then if b.type == 'call' and #b == 1 and b[1] == a then return true - else + elseif a.type == 'call' and #a == 1 and a[1] == b then return false + else + return a.id < b.id end end return rangeA < rangeB diff --git a/server/test/completion/init.lua b/server/test/completion/init.lua index 19bf927a..f288af2a 100644 --- a/server/test/completion/init.lua +++ b/server/test/completion/init.lua @@ -907,6 +907,36 @@ a any } TEST [[ +local function f() + ---@param $ + function f(a, b, c) + end +end +]] +{ + { + label = 'a, b, c', + kind = CompletionItemKind.Snippet, + insertText = [[ +a any +---@param b any +---@param c any]] + }, + { + label = 'a', + kind = CompletionItemKind.Interface, + }, + { + label = 'b', + kind = CompletionItemKind.Interface, + }, + { + label = 'c', + kind = CompletionItemKind.Interface, + }, +} + +TEST [[ ---@param $ function mt:f(a, b, c) end |