summaryrefslogtreecommitdiff
path: root/server/src/core
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-03-01 16:39:52 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-03-01 16:39:52 +0800
commit36404de31bff1228ce1a785883918491db814676 (patch)
tree92f8f712dbe1c6a8336155ed8781bcf1c9c45d9d /server/src/core
parentcaed96510b21d6bdd9e1c4a175be7486c8c8ff5c (diff)
downloadlua-language-server-36404de31bff1228ce1a785883918491db814676.zip
支持标签
Diffstat (limited to 'server/src/core')
-rw-r--r--server/src/core/definition.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/server/src/core/definition.lua b/server/src/core/definition.lua
index 6685f00d..fddd8744 100644
--- a/server/src/core/definition.lua
+++ b/server/src/core/definition.lua
@@ -176,6 +176,22 @@ local function parseValueSimily(vm, source, lsp)
return positions
end
+local function parseLabel(vm, label, lsp)
+ local positions = {}
+ label:eachInfo(function (info)
+ if info.type == 'set' then
+ positions[#positions+1] = {
+ info.source.start,
+ info.source.finish,
+ }
+ end
+ end)
+ if #positions == 0 then
+ return nil
+ end
+ return positions
+end
+
return function (vm, source, lsp)
if not source then
return nil
@@ -187,4 +203,7 @@ return function (vm, source, lsp)
return parseValue(vm, source:bindValue(), lsp)
or parseValueSimily(vm, source, lsp)
end
+ if source:bindLabel() then
+ return parseLabel(vm, source:bindLabel(), lsp)
+ end
end