diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-02-26 15:40:20 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-02-26 15:40:20 +0800 |
commit | 7e2267e96df28669ba339b70bb9cd263a71901aa (patch) | |
tree | 058a1b3312e5624b03e5af4d068418b356e5a7ea /server/src | |
parent | 3852514816cd4d154b55f573e2eb8ca6fd86ec8f (diff) | |
download | lua-language-server-7e2267e96df28669ba339b70bb9cd263a71901aa.zip |
支持局部变量的转到定义
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/core/definition.lua | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/server/src/core/definition.lua b/server/src/core/definition.lua index 21fd7f96..60964676 100644 --- a/server/src/core/definition.lua +++ b/server/src/core/definition.lua @@ -125,6 +125,15 @@ local function parseResultAsVar(vm, result, lsp) return positions end +local function parseLocal(vm, loc, lsp) + local positions = {} + positions[#positions+1] = { + loc.source.start, + loc.source.finish, + } + return positions +end + local function parseValue(vm, value, lsp) local positions = {} value:eachInfo(function (info) @@ -142,6 +151,9 @@ return function (vm, source, lsp) if not source then return nil end + if source:bindLocal() then + return parseLocal(vm, source:bindLocal(), lsp) + end if source:bindValue() then return parseValue(vm, source:bindValue(), lsp) end |