summaryrefslogtreecommitdiff
path: root/script-beta/vm/eachField.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-05-30 17:36:16 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-05-30 17:36:16 +0800
commitab7a1a12a106bdaf980ec8170295092b2cee8006 (patch)
treea21fa5328d1e73fe1018295ee3f71a111183ebae /script-beta/vm/eachField.lua
parenteca92d19c165c697d50ec83fbce5591a60c2124a (diff)
downloadlua-language-server-ab7a1a12a106bdaf980ec8170295092b2cee8006.zip
更新自动完成
Diffstat (limited to 'script-beta/vm/eachField.lua')
-rw-r--r--script-beta/vm/eachField.lua12
1 files changed, 9 insertions, 3 deletions
diff --git a/script-beta/vm/eachField.lua b/script-beta/vm/eachField.lua
index fa995f07..bd6e7db9 100644
--- a/script-beta/vm/eachField.lua
+++ b/script-beta/vm/eachField.lua
@@ -2,8 +2,8 @@ local vm = require 'vm.vm'
local guide = require 'parser.guide'
local library = require 'library'
-local function eachFieldInTableLibrary(source, lib, results)
- if not lib or lib.type ~= 'table' or not lib.child then
+local function eachFieldInLibrary(source, lib, results)
+ if not lib or not lib.child then
return
end
for _, value in pairs(lib.child) do
@@ -18,14 +18,20 @@ local function eachFieldOfLibrary(results)
end
local function eachField(source)
+ while source.type == 'paren' do
+ source = source.exp
+ end
local results = guide.requestFields(source)
local lib = vm.getLibrary(source)
if lib then
- eachFieldInTableLibrary(source, lib, results)
+ eachFieldInLibrary(source, lib, results)
end
if source.special == '_G' then
eachFieldOfLibrary(results)
end
+ if library.object[source.type] then
+ eachFieldInLibrary(source, library.object[source.type], results)
+ end
return results
end