summaryrefslogtreecommitdiff
path: root/server/src/core/completion.lua
diff options
context:
space:
mode:
authorsumneko <sumneko@hotmail.com>2019-04-28 10:57:43 +0800
committersumneko <sumneko@hotmail.com>2019-04-28 10:57:43 +0800
commit0e3fe7fe0c9d660d26a735b0d3d962f4c4289ca8 (patch)
treeee34982f01d594f19ce694001411194d8bcf7876 /server/src/core/completion.lua
parentfdbc780ec38812ad4f63dc1a5cbda2c0d07f7003 (diff)
downloadlua-language-server-0e3fe7fe0c9d660d26a735b0d3d962f4c4289ca8.zip
---@param的自动完成过滤掉self
Diffstat (limited to 'server/src/core/completion.lua')
-rw-r--r--server/src/core/completion.lua18
1 files changed, 13 insertions, 5 deletions
diff --git a/server/src/core/completion.lua b/server/src/core/completion.lua
index 3daf71d5..bf9b8d84 100644
--- a/server/src/core/completion.lua
+++ b/server/src/core/completion.lua
@@ -465,21 +465,29 @@ local function searchEmmyFunctionParam(vm, source, word, callback)
local list = {}
local args = {}
for i, arg in ipairs(func.args) do
- args[i] = arg.name
- if i == 1 then
- list[i] = ('%s any'):format(arg.name)
+ if func:getObject() and i == 1 then
+ goto NEXT
+ end
+ args[#args+1] = arg.name
+ if #list == 0 then
+ list[#list+1] = ('%s any'):format(arg.name)
else
- list[i] = ('---@param %s any'):format(arg.name)
+ list[#list+1] = ('---@param %s any'):format(arg.name)
end
+ :: NEXT ::
end
callback(('%s'):format(table.concat(args, ', ')), nil, CompletionItemKind.Snippet, {
insertText = table.concat(list, '\n')
})
end
- for _, arg in ipairs(func.args) do
+ for i, arg in ipairs(func.args) do
+ if func:getObject() and i == 1 then
+ goto NEXT
+ end
if matchKey(word, arg.name) then
callback(arg.name, nil, CompletionItemKind.Interface)
end
+ :: NEXT ::
end
end