summaryrefslogtreecommitdiff
path: root/script/vm
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-05-25 15:45:35 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-05-25 15:45:35 +0800
commitc586a11e9ae9b3f001c39d7f2f6762b0cf7af671 (patch)
tree396989d94b0c14b749b1393608e9d3b28ce182b3 /script/vm
parent50688a8001325308c30a8669783f1d0e379b463b (diff)
downloadlua-language-server-c586a11e9ae9b3f001c39d7f2f6762b0cf7af671.zip
fix #1155
Diffstat (limited to 'script/vm')
-rw-r--r--script/vm/ref.lua20
1 files changed, 16 insertions, 4 deletions
diff --git a/script/vm/ref.lua b/script/vm/ref.lua
index 545c294a..fbb9d015 100644
--- a/script/vm/ref.lua
+++ b/script/vm/ref.lua
@@ -279,10 +279,22 @@ local function searchByDef(source, pushResult)
defMap[source] = true
return defMap
end
- local defs = vm.getDefs(source)
- for _, def in ipairs(defs) do
- pushResult(def)
- defMap[def] = true
+ if source.type == 'field'
+ or source.type == 'method' then
+ source = source.parent
+ end
+ defMap[source] = true
+ if guide.isSet(source) then
+ local defs = vm.getDefs(source)
+ for _, def in ipairs(defs) do
+ pushResult(def)
+ end
+ else
+ local defs = vm.getDefs(source)
+ for _, def in ipairs(defs) do
+ pushResult(def)
+ defMap[def] = true
+ end
end
return defMap
end