summaryrefslogtreecommitdiff
path: root/server/src/method/textDocument/definition.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-12-26 13:52:59 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-12-26 13:52:59 +0800
commitca498542d4424322e2172425ab02a8986deb477b (patch)
tree093d0af88667c1fac500b0940473fa7b768f724c /server/src/method/textDocument/definition.lua
parent3b76eaf9620585c8f4b3304de030767e61ceb42c (diff)
downloadlua-language-server-ca498542d4424322e2172425ab02a8986deb477b.zip
跨文件的一个提示
Diffstat (limited to 'server/src/method/textDocument/definition.lua')
-rw-r--r--server/src/method/textDocument/definition.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/server/src/method/textDocument/definition.lua b/server/src/method/textDocument/definition.lua
index 75df54da..1f21d67d 100644
--- a/server/src/method/textDocument/definition.lua
+++ b/server/src/method/textDocument/definition.lua
@@ -1,5 +1,18 @@
local matcher = require 'matcher'
+local function checkWorkSpaceComplete(lsp, result)
+ if result.value then
+ if not result.value.isRequire then
+ return
+ end
+ else
+ if not result.isRequire then
+ return
+ end
+ end
+ lsp:checkWorkSpaceComplete()
+end
+
return function (lsp, params)
local uri = params.textDocument.uri
local vm, lines = lsp:loadVM(uri)
@@ -12,6 +25,9 @@ return function (lsp, params)
if not result then
return nil
end
+
+ checkWorkSpaceComplete(lsp, result)
+
local positions = matcher.definition(vm, result)
if not positions then
return nil