summaryrefslogtreecommitdiff
path: root/script/vm/getDef.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-03-04 16:06:28 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-03-04 16:06:28 +0800
commit9451329b33de1e7b69f2793ac5f94715826c9895 (patch)
tree5699d9bae02f77724eb906ce863afaa72a424f62 /script/vm/getDef.lua
parent57a164bf73714f5a4f9d3eb65eb0f0361d21eed7 (diff)
downloadlua-language-server-9451329b33de1e7b69f2793ac5f94715826c9895.zip
update
Diffstat (limited to 'script/vm/getDef.lua')
-rw-r--r--script/vm/getDef.lua20
1 files changed, 15 insertions, 5 deletions
diff --git a/script/vm/getDef.lua b/script/vm/getDef.lua
index b6897bea..8b3e610d 100644
--- a/script/vm/getDef.lua
+++ b/script/vm/getDef.lua
@@ -85,13 +85,23 @@ local searchFieldMap = util.switch()
end
end)
: case 'global'
+ ---@param node vm.node
+ ---@param key string
: call(function (node, key, pushResult)
- local newGlobal = globalMgr.getGlobal('variable', node.name, key)
- if not newGlobal then
- return
+ if node.cate == 'variable' then
+ local newGlobal = globalMgr.getGlobal('variable', node.name, key)
+ if newGlobal then
+ for _, set in ipairs(newGlobal:getSets()) do
+ pushResult(set)
+ end
+ end
end
- for _, set in ipairs(newGlobal:getSets()) do
- pushResult(set)
+ if node.cate == 'type' then
+ compiler.getClassFields(node, key, function (field)
+ if field.type == 'doc.field' then
+ pushResult(field.field)
+ end
+ end)
end
end)
: case 'local'