diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-01-23 17:10:41 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-01-23 17:10:41 +0800 |
commit | 70075c6b951b5af948ff7f3550d136a9863ebf48 (patch) | |
tree | facbdce9a282f9bb018248435edb62640301e1d3 /server/src/core/global.lua | |
parent | c6f18e40500e5c1ffd5c27bc589d413804632cb3 (diff) | |
download | lua-language-server-70075c6b951b5af948ff7f3550d136a9863ebf48.zip |
没必要用readOnly了,因为一定会重新编译全局变量
Diffstat (limited to 'server/src/core/global.lua')
-rw-r--r-- | server/src/core/global.lua | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/server/src/core/global.lua b/server/src/core/global.lua index 9dca50d0..655bc1c4 100644 --- a/server/src/core/global.lua +++ b/server/src/core/global.lua @@ -26,19 +26,22 @@ end function mt:compileVM(uri, vm) local seted = {} - for k, v in pairs(vm.results.globals) do - seted[k] = true - self:markSet(uri, k, v) + local fixed = {} + for _, data in ipairs(vm.results.globals) do + local key = data.global.key + fixed[key] = true + if data.type == 'global' then + seted[key] = true + self:markSet(uri, key, data.global) + end end for k in next, vm.env.child do - if not seted[k] then - self:markGet(uri, k) - end + self:markGet(uri, k) end local needReCompile = {} for otherUri, gets in pairs(self.get) do - for key in pairs(seted) do + for key in pairs(fixed) do if gets[key] ~= nil then needReCompile[#needReCompile+1] = otherUri goto CONTINUE |