From f131f1b530d0726ba66ad4c62f55fa0d59abc4e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Fri, 19 Nov 2021 17:29:29 +0800 Subject: fix duplicate class in completion --- script/core/completion.lua | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'script/core/completion.lua') 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, -- cgit v1.2.3