From 3e37fb57f9548e553e21083acd66339cee528f3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Fri, 8 Mar 2019 17:41:16 +0800 Subject: =?UTF-8?q?=E6=8D=A2=E4=B8=AA=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/core/definition.lua | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'server/src/core/definition.lua') diff --git a/server/src/core/definition.lua b/server/src/core/definition.lua index 2b476b92..9b9cd75e 100644 --- a/server/src/core/definition.lua +++ b/server/src/core/definition.lua @@ -37,6 +37,7 @@ local function parseValueCrossFile(vm, source, lsp) if #positions > 0 then return positions end + value:eachInfo(function (info) if info.type == 'set' and info.source.uri == value.uri then positions[#positions+1] = { @@ -49,6 +50,20 @@ local function parseValueCrossFile(vm, source, lsp) if #positions > 0 then return positions end + + value:eachInfo(function (info) + if info.type == 'return' and info.source.uri == value.uri then + positions[#positions+1] = { + info.source.start, + info.source.finish, + value.uri, + } + end + end) + if #positions > 0 then + return positions + end + local destVM = lsp:getVM(value.uri) if not destVM then positions[#positions+1] = { @@ -68,17 +83,6 @@ local function parseValueCrossFile(vm, source, lsp) return positions end - local main = destVM.main - local mainValue = main:getFunction() - local mainSource = mainValue.source - local returnSource = mainSource[#mainSource] - if returnSource.type == 'return' then - positions[#positions+1] = { - returnSource[1].start, - returnSource[1].finish, - value.uri, - } - end return positions end -- cgit v1.2.3