diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-12-25 14:28:32 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-12-25 14:28:32 +0800 |
commit | d11363524b9d7a98289defb77733d1f16ce381d8 (patch) | |
tree | 035e7915578ca9717ab2a014e0a1b34dd3c4b730 /server/src | |
parent | fed7e101b8815763702b091b925d35908fd1162a (diff) | |
download | lua-language-server-d11363524b9d7a98289defb77733d1f16ce381d8.zip |
修正某些情况下无法跳转的BUG
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/matcher/definition.lua | 6 | ||||
-rw-r--r-- | server/src/matcher/vm.lua | 12 |
2 files changed, 11 insertions, 7 deletions
diff --git a/server/src/matcher/definition.lua b/server/src/matcher/definition.lua index 18804516..b4a19b55 100644 --- a/server/src/matcher/definition.lua +++ b/server/src/matcher/definition.lua @@ -22,6 +22,12 @@ local function parseResultAcrossUri(positions, vm, result) end end end + if #positions == 0 then + positions[#positions+1] = { + 0, 0, + result.value.uri, + } + end end local function parseResult(vm, result) diff --git a/server/src/matcher/vm.lua b/server/src/matcher/vm.lua index fdfeeb21..2156b0e8 100644 --- a/server/src/matcher/vm.lua +++ b/server/src/matcher/vm.lua @@ -504,13 +504,8 @@ function mt:getRequire(strValue, destVM) if main.returns then mainValue = readOnly(main.returns[1]) else - mainValue = self:createValue('boolean', { - type = 'name', - start = 0, - finish = 0, - [1] = '', - uri = destVM.uri, - }, true) + mainValue = self:createValue('boolean', nil, true) + mainValue.uri = destVM.uri end -- 支持 require 'xxx' 的转到定义 @@ -1158,6 +1153,9 @@ function mt:doReturn(action) local value = self:getExp(exp) if value.type == 'list' then if i == #action then + if #value == 0 then + value[1] = self:createValue('any', exp) + end for x, v in ipairs(value) do self:addInfo(v, 'return', exp) self:setFunctionReturn(self:getCurrentFunction(), i + x - 1, v) |