diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-10-25 17:39:30 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-10-25 17:39:30 +0800 |
commit | 33fd161778557ab8f3a511b544d5416b6b8285bd (patch) | |
tree | 2641bf27c7bcff918d809456e2dfe17f15df32c9 /server-beta/src/searcher/eachRef.lua | |
parent | 2f3d7120596d8f814c999f800e9c4c5e4e2664b3 (diff) | |
download | lua-language-server-33fd161778557ab8f3a511b544d5416b6b8285bd.zip |
更新
Diffstat (limited to 'server-beta/src/searcher/eachRef.lua')
-rw-r--r-- | server-beta/src/searcher/eachRef.lua | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/server-beta/src/searcher/eachRef.lua b/server-beta/src/searcher/eachRef.lua index 8230914e..81bfb8bf 100644 --- a/server-beta/src/searcher/eachRef.lua +++ b/server-beta/src/searcher/eachRef.lua @@ -45,12 +45,13 @@ local function checkField(key, info, callback) if key ~= guide.getKeyName(src) then return end + local stype = src.type local mode - if src.type == 'setglobal' then + if stype == 'setglobal' then mode = 'set' - elseif src.type == 'getglobal' then + elseif stype == 'getglobal' then mode = 'get' - elseif src.type == 'field' then + elseif stype == 'field' then local parent = src.parent if parent.type == 'setfield' then mode = 'set' @@ -59,16 +60,25 @@ local function checkField(key, info, callback) elseif parent.type == 'tablefield' then mode = 'set' end - elseif src.type == 'method' then + elseif stype == 'index' then + local parent = src.parent + if parent.type == 'setindex' then + mode = 'set' + elseif parent.type == 'getindex' then + mode = 'get' + elseif parent.type == 'tableindex' then + mode = 'set' + end + elseif stype == 'method' then local parent = src.parent if parent.type == 'setmethod' then mode = 'set' elseif parent.type == 'getmethod' then mode = 'get' end - elseif src.type == 'number' - or src.type == 'string' - or src.type == 'boolean' then + elseif stype == 'number' + or stype == 'string' + or stype == 'boolean' then local parent = src.parent if parent.type == 'setindex' then mode = 'set' |