diff options
author | unknown <sumnekosun@intranet.123u.com> | 2019-04-02 16:09:21 +0800 |
---|---|---|
committer | unknown <sumnekosun@intranet.123u.com> | 2019-04-02 16:09:21 +0800 |
commit | 6295603638959c0a11634c76381b20988f32d2a2 (patch) | |
tree | 65344a0ae2f2bc8caa5a0eaae9d89ddff73e2c84 /server/src/core/completion.lua | |
parent | d8a0908e2ceff54e54379a7b36189eedd29f2361 (diff) | |
download | lua-language-server-6295603638959c0a11634c76381b20988f32d2a2.zip |
修正bug
Diffstat (limited to 'server/src/core/completion.lua')
-rw-r--r-- | server/src/core/completion.lua | 40 |
1 files 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)) |