diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/src/core/definition.lua | 26 | ||||
-rw-r--r-- | server/src/vm/vm.lua | 3 |
2 files changed, 17 insertions, 12 deletions
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 diff --git a/server/src/vm/vm.lua b/server/src/vm/vm.lua index 643c68ea..07e6917f 100644 --- a/server/src/vm/vm.lua +++ b/server/src/vm/vm.lua @@ -696,7 +696,8 @@ function mt:doReturn(action) local func = self:getCurrentFunction() values:eachValue(function (n, value) value.uri = self:getUri() - func:setReturn(n, value, action[n]) + func:setReturn(n, value) + value:addInfo('return', action[n]) end) end |