From 13213502dc06cfa709ff838f3d93516624191471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 13 Jan 2022 20:09:42 +0800 Subject: fix `window.statusBar` and `telemetry.enable` --- script/service/telemetry.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'script/service/telemetry.lua') 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) -- cgit v1.2.3