diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-11-19 17:29:29 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-11-19 17:29:29 +0800 |
commit | f131f1b530d0726ba66ad4c62f55fa0d59abc4e1 (patch) | |
tree | 46af0ea5c3fc90d7bd21c6b05f28a4ffc97c6fb0 /script/core/completion.lua | |
parent | 8b1c6ac771a3a1bcc938863235b31580ba32b4ee (diff) | |
download | lua-language-server-f131f1b530d0726ba66ad4c62f55fa0d59abc4e1.zip |
fix duplicate class in completion
Diffstat (limited to 'script/core/completion.lua')
-rw-r--r-- | script/core/completion.lua | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/script/core/completion.lua b/script/core/completion.lua index 785d3054..4dd55070 100644 --- a/script/core/completion.lua +++ b/script/core/completion.lua @@ -1688,10 +1688,13 @@ end local function tryluaDocBySource(state, position, source, results) if source.type == 'doc.extends.name' then if source.parent.type == 'doc.class' then + local used = {} for _, doc in ipairs(vm.getDocDefines '*') do if doc.type == 'doc.class.name' and doc.parent ~= source.parent + and not used[doc[1]] and matchKey(source[1], doc[1]) then + used[doc[1]] = true results[#results+1] = { label = doc[1], kind = define.CompletionItemKind.Class, @@ -1706,10 +1709,13 @@ local function tryluaDocBySource(state, position, source, results) end return true elseif source.type == 'doc.type.name' then + local used = {} for _, doc in ipairs(vm.getDocDefines '*') do if (doc.type == 'doc.class.name' or doc.type == 'doc.alias.name') and doc.parent ~= source.parent + and not used[doc[1]] and matchKey(source[1], doc[1]) then + used[doc[1]] = true results[#results+1] = { label = doc[1], kind = define.CompletionItemKind.Class, |