diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-09-24 21:58:16 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-09-24 21:58:16 +0800 |
commit | 5e9f40d4666055c5998df0c3137db83127f5623b (patch) | |
tree | bb448f1fd7f2ef811d12cd0b99699818a4392986 /server-beta/src/core | |
parent | c025849321b444b84eacd4e091cfa574ca6bc472 (diff) | |
download | lua-language-server-5e9f40d4666055c5998df0c3137db83127f5623b.zip |
更新 definition
Diffstat (limited to 'server-beta/src/core')
-rw-r--r-- | server-beta/src/core/definition.lua | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/server-beta/src/core/definition.lua b/server-beta/src/core/definition.lua index 6f6689b4..fd01072e 100644 --- a/server-beta/src/core/definition.lua +++ b/server-beta/src/core/definition.lua @@ -37,22 +37,24 @@ function m.aslocal(state, ast, source) end end -function m.assetglobal(state, ast, source) +function m.globals(state, ast, source) local name = source[1] - guide.eachSourceOf(ast.root, 'setglobal', function (src) - if src[1] == name then + guide.eachGloabl(ast.root, function (src, gname) + if name ~= gname then + return + end + if src.type == 'setglobal' or src.type == 'setfield' then state.callback(src, ast.uri) end end) end +function m.assetglobal(state, ast, source) + m.globals(state, ast, source) +end + function m.asgetglobal(state, ast, source) - local name = source[1] - guide.eachSourceOf(ast.root, 'setglobal', function (src) - if src[1] == name then - state.callback(src, ast.uri) - end - end) + m.globals(state, ast, source) end return function (ast, text, offset) |