summaryrefslogtreecommitdiff
path: root/server/src/core
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-03-01 15:51:22 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-03-01 15:51:22 +0800
commit302526e4311cb7f54b327d7bdd999a2e60f89eba (patch)
tree34466aa1043df5d10d0dfd063283b51e566467d8 /server/src/core
parent510c8d897837d33f24023f0b9384763be88b7e1e (diff)
downloadlua-language-server-302526e4311cb7f54b327d7bdd999a2e60f89eba.zip
更新转到定义
Diffstat (limited to 'server/src/core')
-rw-r--r--server/src/core/definition.lua30
1 files changed, 30 insertions, 0 deletions
diff --git a/server/src/core/definition.lua b/server/src/core/definition.lua
index 60964676..6685f00d 100644
--- a/server/src/core/definition.lua
+++ b/server/src/core/definition.lua
@@ -131,6 +131,9 @@ local function parseLocal(vm, loc, lsp)
loc.source.start,
loc.source.finish,
}
+ if #positions == 0 then
+ return nil
+ end
return positions
end
@@ -144,6 +147,32 @@ local function parseValue(vm, value, lsp)
}
end
end)
+ if #positions == 0 then
+ return nil
+ end
+ return positions
+end
+
+local function parseValueSimily(vm, source, lsp)
+ local key = source[1]
+ if not key then
+ return nil
+ end
+ local positions = {}
+ for _, other in ipairs(vm.sources) do
+ if other == source then
+ break
+ end
+ if other[1] == key and not other:bindLocal() and other:bindValue() and other:action() == 'set' then
+ positions[#positions+1] = {
+ other.start,
+ other.finish,
+ }
+ end
+ end
+ if #positions == 0 then
+ return nil
+ end
return positions
end
@@ -156,5 +185,6 @@ return function (vm, source, lsp)
end
if source:bindValue() then
return parseValue(vm, source:bindValue(), lsp)
+ or parseValueSimily(vm, source, lsp)
end
end