summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-03-06 18:05:31 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-03-06 18:05:31 +0800
commitaeb55a1183916355774b7843fd6dfb6023567a40 (patch)
tree0b092e7c93d3e7b3ca105de5af0dae64859501c8 /server
parentf9b3e7070d4239687e8db16393b81213c4a701cd (diff)
downloadlua-language-server-aeb55a1183916355774b7843fd6dfb6023567a40.zip
更新自动完成的支持
Diffstat (limited to 'server')
-rw-r--r--server/src/core/completion.lua1
-rw-r--r--server/src/vm/value.lua13
2 files changed, 13 insertions, 1 deletions
diff --git a/server/src/core/completion.lua b/server/src/core/completion.lua
index 07144255..b287b89b 100644
--- a/server/src/core/completion.lua
+++ b/server/src/core/completion.lua
@@ -266,6 +266,7 @@ local function searchSource(vm, source, word, callback)
end
if source:get 'simple' then
searchAsSuffix(vm, source, word, callback)
+ return
end
end
diff --git a/server/src/vm/value.lua b/server/src/vm/value.lua
index 6684c691..7513ebd1 100644
--- a/server/src/vm/value.lua
+++ b/server/src/vm/value.lua
@@ -89,6 +89,17 @@ function mt:getLibChild(index)
end
end
+function mt:eachLibChild(callback)
+ local tp = self:getType()
+ local lib = library.object[tp]
+ if lib then
+ local childs = libraryBuilder.child(lib)
+ for k, v in pairs(childs) do
+ callback(k, v)
+ end
+ end
+end
+
function mt:getChild(index, mark)
self:setType('table', 0.5)
local value = self:rawGet(index)
@@ -155,7 +166,7 @@ function mt:eachChild(callback, mark, foundIndex)
end
local method = self:getMetaMethod('__index')
if not method then
- return nil
+ return self:eachLibChild(callback)
end
if not mark then
mark = {}