diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-12-12 21:00:12 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-12-12 21:00:12 +0800 |
commit | 3ce89009f9e37193a00aa3eefb09f46eaff409c7 (patch) | |
tree | 401e3e3798a1b64e0ce8f66168a2f3849415eea9 /server/src/matcher/vm.lua | |
parent | bf31ca7ebf54d094ca8b13ca1486cbe8e6e9ef4c (diff) | |
download | lua-language-server-3ce89009f9e37193a00aa3eefb09f46eaff409c7.zip |
只有存在二义性的时候才提示
Diffstat (limited to 'server/src/matcher/vm.lua')
-rw-r--r-- | server/src/matcher/vm.lua | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/server/src/matcher/vm.lua b/server/src/matcher/vm.lua index 3f1e7d2a..16034eaf 100644 --- a/server/src/matcher/vm.lua +++ b/server/src/matcher/vm.lua @@ -585,6 +585,11 @@ function mt:unpackList(list) res[1] = value end end + for _, v in ipairs(res) do + if v.type == 'list' then + error('Unpack list') + end + end return res end @@ -600,6 +605,7 @@ function mt:getSimple(simple, mode) parentName = '?' end local object + local lastField = field for i = 2, #simple do local obj = simple[i] local tp = obj.type @@ -616,7 +622,8 @@ function mt:getSimple(simple, mode) end self.results.calls[#self.results.calls+1] = { call = obj, - lastobj = simple[i-1], + lastObj = simple[i-1], + nextObj = simple[i+1], } parentName = parentName .. '(...)' elseif obj.index then @@ -628,8 +635,9 @@ function mt:getSimple(simple, mode) self:addInfo(field, 'get', obj) end end + field.parent = lastField + lastField = field obj.object = object - obj.parentName = parentName if obj.type == 'string' then parentName = ('%s[%q]'):format(parentName, index) @@ -645,6 +653,8 @@ function mt:getSimple(simple, mode) if mode == 'value' or i < #simple then self:addInfo(field, 'get', obj) end + field.parent = lastField + lastField = field obj.object = object obj.parentName = parentName parentName = parentName .. '.' .. field.key |