diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-05-25 15:45:35 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-05-25 15:45:35 +0800 |
commit | c586a11e9ae9b3f001c39d7f2f6762b0cf7af671 (patch) | |
tree | 396989d94b0c14b749b1393608e9d3b28ce182b3 /script/vm | |
parent | 50688a8001325308c30a8669783f1d0e379b463b (diff) | |
download | lua-language-server-c586a11e9ae9b3f001c39d7f2f6762b0cf7af671.zip |
fix #1155
Diffstat (limited to 'script/vm')
-rw-r--r-- | script/vm/ref.lua | 20 |
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 |