summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 = {}