From ca498542d4424322e2172425ab02a8986deb477b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 26 Dec 2018 13:52:59 +0800 Subject: =?UTF-8?q?=E8=B7=A8=E6=96=87=E4=BB=B6=E7=9A=84=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/method/textDocument/definition.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'server/src/method/textDocument/definition.lua') 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 -- cgit v1.2.3