Skip to content

Commit 1321350

Browse files
committed
fix window.statusBar and telemetry.enable
1 parent 2d1119f commit 1321350

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

script/provider/provider.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,7 +1023,7 @@ do
10231023
end
10241024

10251025
local function refreshStatusBar()
1026-
local valid = true
1026+
local valid = config.get(nil, 'Lua.window.statusBar')
10271027
for _, scp in ipairs(workspace.folders) do
10281028
if not config.get(scp.uri, 'Lua.window.statusBar') then
10291029
valid = false
@@ -1038,7 +1038,8 @@ local function refreshStatusBar()
10381038
end
10391039

10401040
config.watch(function (uri, key, value)
1041-
if key == 'Lua.window.statusBar' then
1041+
if key == 'Lua.window.statusBar'
1042+
or key == '' then
10421043
refreshStatusBar()
10431044
end
10441045
end)

script/service/telemetry.lua

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ local lang = require 'language'
1010
local define = require 'proto.define'
1111
local await = require 'await'
1212
local version = require 'version'
13+
local ws = require 'workspace'
1314

1415
local tokenPath = (ROOT / 'log' / 'token'):string()
1516
local token = util.loadFile(tokenPath)
@@ -105,21 +106,19 @@ end)
105106

106107
local m = {}
107108

108-
function m.updateConfig(uri, value)
109-
validMap[uri or ''] = value
109+
function m.updateConfig()
110110
isValid = config.get(nil, 'Lua.telemetry.enable')
111111
if isValid == false then
112112
return
113113
end
114-
-- one false, all false
115-
for _, v in pairs(validMap) do
116-
if v == false then
114+
for _, scp in ipairs(ws.folders) do
115+
if config.get(scp.uri, 'Lua.telemetry.enable') == false then
117116
isValid = false
118117
return
119118
end
120119
end
121-
for _, v in pairs(validMap) do
122-
if v == true then
120+
for _, scp in ipairs(ws.folders) do
121+
if config.get(scp.uri, 'Lua.telemetry.enable') == true then
123122
isValid = true
124123
break
125124
end
@@ -173,8 +172,9 @@ function m.updateConfig(uri, value)
173172
end
174173

175174
config.watch(function (uri, key, value)
176-
if key == 'Lua.telemetry.enable' then
177-
m.updateConfig(uri, value)
175+
if key == 'Lua.telemetry.enable'
176+
or key == '' then
177+
m.updateConfig()
178178
end
179179
end)
180180

0 commit comments

Comments
 (0)