diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-10-08 15:45:14 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-10-08 15:45:14 +0800 |
commit | 2929f89bc1fa96a7b48ee1f736cd50c9d6fc5ab4 (patch) | |
tree | 0a715582226e3717724d8e298b3b2f97ebdee19e /server-beta/src/core/engineer.lua | |
parent | 005f94454fe50382c64e71f9d36fb7064895134f (diff) | |
download | lua-language-server-2929f89bc1fa96a7b48ee1f736cd50c9d6fc5ab4.zip |
支持table
Diffstat (limited to 'server-beta/src/core/engineer.lua')
-rw-r--r-- | server-beta/src/core/engineer.lua | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/server-beta/src/core/engineer.lua b/server-beta/src/core/engineer.lua index 0f0bff95..5fc92e7e 100644 --- a/server-beta/src/core/engineer.lua +++ b/server-beta/src/core/engineer.lua @@ -59,9 +59,14 @@ mt['local'] = function (self, source, mode, callback) or tp == 'getindex' then callback(parent) end + elseif ref.type == 'setlocal' then + self:eachRef(ref.value, 'field', callback) end end end + if source.value then + self:eachRef(source.value, 'field', callback) + end end end mt['getlocal'] = function (self, source, mode, callback) @@ -142,8 +147,13 @@ mt['field'] = function (self, source, mode, callback) self:eachRef(node, 'field', function (src) if key == guide.getKeyName(src) then if mode == 'def' then - if src.type == 'setfield' then + if src.type == 'setfield' + or src.type == 'tablefield' + then callback(src.field, 'set') + elseif src.type == 'setindex' + or src.type == 'tableindex' then + callback(src.index, 'set') end end end @@ -189,6 +199,17 @@ mt['boolean'] = mt['asindex'] mt['string'] = function (self, source, mode, callback) mt['asindex'](self, source, mode, callback) end +mt['table'] = function (self, source, mode, callback) + if mode == 'field' then + for i = 1, #source do + local src = source[i] + if src.type == 'tablefield' + or src.type == 'tableindex' then + callback(src) + end + end + end +end function mt:getSpecial(source) local node = source.node |