diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-11-09 11:33:45 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-11-09 11:33:45 +0800 |
commit | 539622ccb8ac8bef1266ffcd5fbcdc1043d2a7cf (patch) | |
tree | efeb162f4040b1966ecd975dee9d97a2f2642a7d /script-beta | |
parent | 9e40b80887ebf4b9284127e7e898387ffc1bf9c8 (diff) | |
download | lua-language-server-539622ccb8ac8bef1266ffcd5fbcdc1043d2a7cf.zip |
局部变量对象不进行语义着色
Diffstat (limited to 'script-beta')
-rw-r--r-- | script-beta/core/semantic-tokens.lua | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/script-beta/core/semantic-tokens.lua b/script-beta/core/semantic-tokens.lua index 21a251be..7ebe5de2 100644 --- a/script-beta/core/semantic-tokens.lua +++ b/script-beta/core/semantic-tokens.lua @@ -50,22 +50,7 @@ Care['tablefield'] = function (source, results) end Care['getlocal'] = function (source, results) local loc = source.node - -- 1. 函数的参数 - if loc.parent and loc.parent.type == 'funcargs' then - results[#results+1] = { - start = source.start, - finish = source.finish, - type = define.TokenTypes.parameter, - modifieres = define.TokenModifiers.declaration, - } - return - end - -- 2. 特殊变量 - if source[1] == '_ENV' - or source[1] == 'self' then - return - end - -- 3. 不是函数的局部变量 + -- 1. 值为函数的局部变量 local hasFunc local node = loc.node if node then @@ -87,7 +72,27 @@ Care['getlocal'] = function (source, results) } return end - -- 4. 其他 + -- 2. 对象 + if source.parent.type == 'getmethod' + and source.parent.node == source then + return + end + -- 3. 函数的参数 + if loc.parent and loc.parent.type == 'funcargs' then + results[#results+1] = { + start = source.start, + finish = source.finish, + type = define.TokenTypes.parameter, + modifieres = define.TokenModifiers.declaration, + } + return + end + -- 4. 特殊变量 + if source[1] == '_ENV' + or source[1] == 'self' then + return + end + -- 5. 其他 results[#results+1] = { start = source.start, finish = source.finish, |