From 6295603638959c0a11634c76381b20988f32d2a2 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 2 Apr 2019 16:09:21 +0800 Subject: =?UTF-8?q?=E4=BF=AE=E6=AD=A3bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/core/completion.lua | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/server/src/core/completion.lua b/server/src/core/completion.lua index cf9a1a90..85f0b95e 100644 --- a/server/src/core/completion.lua +++ b/server/src/core/completion.lua @@ -215,27 +215,41 @@ local function searchFields(vm, source, word, callback) return end local map = {} - parent:eachChild(function (k, v) + parent:eachInfo(function (info, src) + local k = info[1] + local v = info[2] + if src == source then + return + end + if map[k] then + return + end + if info.type ~= 'set child' and info.type ~= 'get child' then + return + end if type(k) ~= 'string' then - goto CONTINUE + return end if source:get 'object' and v:getType() ~= 'function' then - goto CONTINUE + return end - if k == word then - local ok = v:eachInfo(function (_, src) - if src ~= source then - return true - end - end) - if not ok then - goto CONTINUE - end + if matchKey(word, k) then + map[k] = parent:getChild(k) + end + end) + parent:eachLibChild(function (k, v) + if map[k] then + return + end + if type(k) ~= 'string' then + return + end + if source:get 'object' and v:getType() ~= 'function' then + return end if matchKey(word, k) then map[k] = v end - :: CONTINUE :: end) for k, v in sortPairs(map) do callback(k, nil, CompletionItemKind.Field, getValueData('field', k, v)) -- cgit v1.2.3