diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-03-12 11:04:59 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-03-12 11:04:59 +0800 |
commit | 9235116d2a54052f9be43e9291d70dd4f85840ad (patch) | |
tree | 78cc8b8b1d4105df57715c05048c25a555dc0423 /server/src/method/textDocument/definition.lua | |
parent | a17d8407524697f18d153c30196132db57e9b8d4 (diff) | |
download | lua-language-server-9235116d2a54052f9be43e9291d70dd4f85840ad.zip |
跟进协议
Diffstat (limited to 'server/src/method/textDocument/definition.lua')
-rw-r--r-- | server/src/method/textDocument/definition.lua | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/server/src/method/textDocument/definition.lua b/server/src/method/textDocument/definition.lua index 8c8a2bb7..a9c05752 100644 --- a/server/src/method/textDocument/definition.lua +++ b/server/src/method/textDocument/definition.lua @@ -1,17 +1,11 @@ local core = require 'core' -local function checkWorkSpaceComplete(lsp, result) - if result.type ~= 'field' and result.type ~= 'local' then +local function checkWorkSpaceComplete(lsp, source) + if not source:bindValue() then return end - if result.value then - if not result.value.isRequire then - return - end - else - if not result.isRequire then - return - end + if not source:bindValue():get 'cross file' then + return end lsp:checkWorkSpaceComplete() end @@ -24,14 +18,14 @@ return function (lsp, params) end -- lua是从1开始的,因此都要+1 local position = lines:position(params.position.line + 1, params.position.character + 1) - local result = core.findSource(vm, position) - if not result then + local source = core.findSource(vm, position) + if not source then return nil end - checkWorkSpaceComplete(lsp, result) + checkWorkSpaceComplete(lsp, source) - local positions = core.definition(vm, result, lsp) + local positions = core.definition(vm, source, lsp) if not positions then return nil end |