summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script-beta/vm/eachField.lua10
-rw-r--r--test-beta/completion/init.lua12
2 files changed, 16 insertions, 6 deletions
diff --git a/script-beta/vm/eachField.lua b/script-beta/vm/eachField.lua
index d6ef315b..b60a882a 100644
--- a/script-beta/vm/eachField.lua
+++ b/script-beta/vm/eachField.lua
@@ -148,6 +148,16 @@ local function eachField(source, callback)
elseif src.type == 'table' then
ofTabel(src, callback)
end
+ local lib = library.object[src.type]
+ if lib then
+ for k, v in pairs(lib.child) do
+ callback {
+ source = v,
+ key = 's|' .. k,
+ mode = 'value',
+ }
+ end
+ end
end)
end
diff --git a/test-beta/completion/init.lua b/test-beta/completion/init.lua
index 579d5ebb..29d870f8 100644
--- a/test-beta/completion/init.lua
+++ b/test-beta/completion/init.lua
@@ -40,6 +40,10 @@ function TEST(script)
files.setText('', new_script)
local result = core.completion('', pos)
+ if not expect then
+ assert(result == nil)
+ return
+ end
for _, item in ipairs(result) do
core.resolve(item.id)
for k in pairs(item) do
@@ -48,12 +52,8 @@ function TEST(script)
end
end
end
- if expect then
- assert(result)
- assert(eq(expect, result))
- else
- assert(result == nil)
- end
+ assert(result)
+ assert(eq(expect, result))
end
end