diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-01-13 20:09:42 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-01-13 20:09:42 +0800 |
commit | 13213502dc06cfa709ff838f3d93516624191471 (patch) | |
tree | 885deb9e15d7d3e70d388648766155c20ea4f980 /script/service/telemetry.lua | |
parent | 2d1119fac03e102a376140006a3eb9c8a4c59e3b (diff) | |
download | lua-language-server-13213502dc06cfa709ff838f3d93516624191471.zip |
fix `window.statusBar` and `telemetry.enable`
Diffstat (limited to 'script/service/telemetry.lua')
-rw-r--r-- | script/service/telemetry.lua | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/script/service/telemetry.lua b/script/service/telemetry.lua index d20719b0..94335fb9 100644 --- a/script/service/telemetry.lua +++ b/script/service/telemetry.lua @@ -10,6 +10,7 @@ local lang = require 'language' local define = require 'proto.define' local await = require 'await' local version = require 'version' +local ws = require 'workspace' local tokenPath = (ROOT / 'log' / 'token'):string() local token = util.loadFile(tokenPath) @@ -105,21 +106,19 @@ end) local m = {} -function m.updateConfig(uri, value) - validMap[uri or ''] = value +function m.updateConfig() isValid = config.get(nil, 'Lua.telemetry.enable') if isValid == false then return end - -- one false, all false - for _, v in pairs(validMap) do - if v == false then + for _, scp in ipairs(ws.folders) do + if config.get(scp.uri, 'Lua.telemetry.enable') == false then isValid = false return end end - for _, v in pairs(validMap) do - if v == true then + for _, scp in ipairs(ws.folders) do + if config.get(scp.uri, 'Lua.telemetry.enable') == true then isValid = true break end @@ -173,8 +172,9 @@ function m.updateConfig(uri, value) end config.watch(function (uri, key, value) - if key == 'Lua.telemetry.enable' then - m.updateConfig(uri, value) + if key == 'Lua.telemetry.enable' + or key == '' then + m.updateConfig() end end) |