summaryrefslogtreecommitdiff
path: root/server/src/core/implementation.lua
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/core/implementation.lua')
-rw-r--r--server/src/core/implementation.lua48
1 files changed, 37 insertions, 11 deletions
diff --git a/server/src/core/implementation.lua b/server/src/core/implementation.lua
index 36a990ee..b0fa6e9e 100644
--- a/server/src/core/implementation.lua
+++ b/server/src/core/implementation.lua
@@ -93,19 +93,45 @@ local function parseValueCrossFile(vm, source, lsp)
end
local function parseValue(vm, source, lsp)
- local value = source:bindValue()
- if value.uri ~= '' and value.uri ~= vm.uri then
- return parseValueCrossFile(vm, source, lsp)
- end
local positions = {}
- value:eachInfo(function (info, src)
- if info.type == 'set' then
- positions[#positions+1] = {
- src.start,
- src.finish,
- }
+ local mark = {}
+
+ local function callback(src)
+ if mark[src] then
+ return
end
- end)
+ mark[src] = true
+ if src.start == 0 then
+ return
+ end
+ local uri = src.uri
+ if uri == '' then
+ uri = nil
+ end
+ positions[#positions+1] = {
+ src.start,
+ src.finish,
+ uri,
+ }
+ end
+
+ if source:bindValue() then
+ source:bindValue():eachInfo(function (info, src)
+ if info.type == 'set' or info.type == 'local' then
+ callback(src)
+ end
+ end)
+ end
+ local parent = source:get 'parent'
+ if parent then
+ parent:eachInfo(function (info, src)
+ if info[1] == source[1] then
+ if info.type == 'set child' then
+ callback(src)
+ end
+ end
+ end)
+ end
if #positions == 0 then
return nil
end