summaryrefslogtreecommitdiff
path: root/server/src/core/completion.lua
diff options
context:
space:
mode:
authorunknown <sumnekosun@intranet.123u.com>2019-04-02 16:09:21 +0800
committerunknown <sumnekosun@intranet.123u.com>2019-04-02 16:09:21 +0800
commit6295603638959c0a11634c76381b20988f32d2a2 (patch)
tree65344a0ae2f2bc8caa5a0eaae9d89ddff73e2c84 /server/src/core/completion.lua
parentd8a0908e2ceff54e54379a7b36189eedd29f2361 (diff)
downloadlua-language-server-6295603638959c0a11634c76381b20988f32d2a2.zip
修正bug
Diffstat (limited to 'server/src/core/completion.lua')
-rw-r--r--server/src/core/completion.lua40
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))