summaryrefslogtreecommitdiff
path: root/script/core/definition.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-02-18 11:23:16 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-02-18 11:23:16 +0800
commite49ace7ba501bba270ddd0f394debe694830a831 (patch)
tree21b915b70c350e2882fdd6c2bc709ae04aa98c2b /script/core/definition.lua
parent5163ff8323411bc6a90504c66871cea60eeeb994 (diff)
downloadlua-language-server-e49ace7ba501bba270ddd0f394debe694830a831.zip
close #391 definition excludes values
Diffstat (limited to 'script/core/definition.lua')
-rw-r--r--script/core/definition.lua14
1 files changed, 13 insertions, 1 deletions
diff --git a/script/core/definition.lua b/script/core/definition.lua
index 43d1b640..0ea20a02 100644
--- a/script/core/definition.lua
+++ b/script/core/definition.lua
@@ -126,7 +126,19 @@ return function (uri, offset)
end
end
- for _, src in ipairs(vm.getDefs(source, 0)) do
+ local defs = vm.getDefs(source, 0)
+ local values = {}
+ for _, src in ipairs(defs) do
+ local value = guide.getObjectValue(src)
+ if value and value ~= src then
+ values[value] = true
+ end
+ end
+
+ for _, src in ipairs(defs) do
+ if values[src] then
+ goto CONTINUE
+ end
local root = guide.getRoot(src)
if not root then
goto CONTINUE