diff options
author | sumneko <sumneko@hotmail.com> | 2019-04-19 17:04:28 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2019-04-19 17:04:28 +0800 |
commit | 7c4840555590078785a118065abf11b9832e95e7 (patch) | |
tree | ffff7010d2f5c670b808115f704092dd3a4a7b90 /server/src | |
parent | c33b3ad05149a20b2731aadc8e7c76771cde51e4 (diff) | |
download | lua-language-server-7c4840555590078785a118065abf11b9832e95e7.zip |
允许 _G.xx 形式的全局变量
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/core/diagnostics.lua | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/server/src/core/diagnostics.lua b/server/src/core/diagnostics.lua index 33037d5f..d49f8da2 100644 --- a/server/src/core/diagnostics.lua +++ b/server/src/core/diagnostics.lua @@ -256,23 +256,23 @@ function mt:searchLowercaseGlobal(callback) for name in pairs(library.global) do definedGlobal[name] = true end - local uri = self.vm.uri - local envValue = self.vm.env:getValue() - envValue:eachInfo(function (info, src) - if info.type == 'set child' and src.uri == uri then - local name = info[1] + self.vm:eachSource(function (source) + if source.type == 'name' + and source:get 'parent' + and not source:get 'simple' + and not source:get 'table index' + and source:action() == 'set' + then + local name = source[1] if definedGlobal[name] then return end - if type(name) ~= 'string' then - return - end local first = name:match '%w' if not first then return end if first:match '%l' then - callback(src.start, src.finish) + callback(source.start, source.finish) end end end) |