summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
Diffstat (limited to 'script')
-rw-r--r--script/provider/provider.lua5
-rw-r--r--script/service/telemetry.lua18
2 files changed, 12 insertions, 11 deletions
diff --git a/script/provider/provider.lua b/script/provider/provider.lua
index 1c84caf1..4b22cb47 100644
--- a/script/provider/provider.lua
+++ b/script/provider/provider.lua
@@ -1023,7 +1023,7 @@ do
end
local function refreshStatusBar()
- local valid = true
+ local valid = config.get(nil, 'Lua.window.statusBar')
for _, scp in ipairs(workspace.folders) do
if not config.get(scp.uri, 'Lua.window.statusBar') then
valid = false
@@ -1038,7 +1038,8 @@ local function refreshStatusBar()
end
config.watch(function (uri, key, value)
- if key == 'Lua.window.statusBar' then
+ if key == 'Lua.window.statusBar'
+ or key == '' then
refreshStatusBar()
end
end)
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)