diff options
author | sumneko <sumneko@hotmail.com> | 2019-04-19 17:05:09 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2019-04-19 17:05:09 +0800 |
commit | 02631f902a8230e173bd46dd83193c69e06bb7f1 (patch) | |
tree | a28e89f3c0c59e9704272fea494f3284e419db49 /server | |
parent | 399b06f07224bf8666440b7bb83fa32f458b6edf (diff) | |
parent | 7c4840555590078785a118065abf11b9832e95e7 (diff) | |
download | lua-language-server-02631f902a8230e173bd46dd83193c69e06bb7f1.zip |
Merge branch 'master' into EmmyLua
Diffstat (limited to 'server')
-rw-r--r-- | server/src/core/diagnostics.lua | 18 | ||||
-rw-r--r-- | server/src/vm/function.lua | 6 | ||||
-rw-r--r-- | server/test/diagnostics/init.lua | 1 |
3 files changed, 13 insertions, 12 deletions
diff --git a/server/src/core/diagnostics.lua b/server/src/core/diagnostics.lua index 8d668f04..0732b7e3 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) diff --git a/server/src/vm/function.lua b/server/src/vm/function.lua index 20a5c75b..7df9c3ea 100644 --- a/server/src/vm/function.lua +++ b/server/src/vm/function.lua @@ -151,9 +151,9 @@ function mt:setReturn(index, value) end if value then self.returns[index] = value - end - if self._global then - value:markGlobal() + if self._global then + value:markGlobal() + end end end diff --git a/server/test/diagnostics/init.lua b/server/test/diagnostics/init.lua index c82a3eaa..4b762122 100644 --- a/server/test/diagnostics/init.lua +++ b/server/test/diagnostics/init.lua @@ -240,6 +240,7 @@ TEST [[ <!aa!> = 1 tostring = 1 ROOT = 1 +_G.bb = 1 ]] TEST [[ |