diff options
author | sumneko <sumneko@hotmail.com> | 2022-02-17 13:54:17 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2022-02-17 13:54:17 +0800 |
commit | ba55a9f6dbf57b5b9ec38f1978caa7178f44f13d (patch) | |
tree | ff48e3916e9295ee8a7200bd1213f73bd4aad9d4 /script | |
parent | 12d6a9eb75f31b64cbc89eb3265805bc8dad01f0 (diff) | |
download | lua-language-server-ba55a9f6dbf57b5b9ec38f1978caa7178f44f13d.zip |
`FIX` telemetry is not disabled by default
Diffstat (limited to 'script')
-rw-r--r-- | script/client.lua | 4 | ||||
-rw-r--r-- | script/config/config.lua | 2 | ||||
-rw-r--r-- | script/service/telemetry.lua | 8 |
3 files changed, 8 insertions, 6 deletions
diff --git a/script/client.lua b/script/client.lua index 0388ff39..5095b772 100644 --- a/script/client.lua +++ b/script/client.lua @@ -197,7 +197,7 @@ end ---@field prop? string ---@field value any ---@field action '"add"'|'"set"'|'"prop"' ----@field isGlobal? boolean +---@field global? boolean ---@field uri? uri ---@param cfg table @@ -298,7 +298,7 @@ local function tryModifyClientGlobal(finalChanges) local changes = {} for i = #finalChanges, 1, -1 do local change = finalChanges[i] - if change.isGlobal then + if change.global then changes[#changes+1] = change finalChanges[i] = finalChanges[#finalChanges] finalChanges[#finalChanges] = nil diff --git a/script/config/config.lua b/script/config/config.lua index a53b77b5..88881731 100644 --- a/script/config/config.lua +++ b/script/config/config.lua @@ -212,7 +212,7 @@ local Template = { ['Lua.IntelliSense.traceReturn'] = Type.Boolean >> false, ['Lua.IntelliSense.traceBeSetted'] = Type.Boolean >> false, ['Lua.IntelliSense.traceFieldInject'] = Type.Boolean >> false, - ['Lua.telemetry.enable'] = Type.Or(Type.Boolean >> false, Type.Nil), + ['Lua.telemetry.enable'] = Type.Or(Type.Boolean >> false, Type.Nil) >> nil, ['files.associations'] = Type.Hash(Type.String, Type.String), ['files.exclude'] = Type.Hash(Type.String, Type.Boolean), ['editor.semanticHighlighting.enabled'] = Type.Or(Type.Boolean, Type.String), diff --git a/script/service/telemetry.lua b/script/service/telemetry.lua index 94335fb9..1b3e2972 100644 --- a/script/service/telemetry.lua +++ b/script/service/telemetry.lua @@ -78,7 +78,7 @@ local isValid = false timer.wait(5, function () timer.loop(300, function () - if not isValid then + if isValid ~= true then return end local suc, link = pcall(net.connect, 'tcp', 'moe-moe.love', 11577) @@ -97,7 +97,7 @@ timer.wait(5, function () end end)() timer.loop(1, function () - if not isValid then + if isValid ~= true then return end net.update() @@ -107,7 +107,9 @@ end) local m = {} function m.updateConfig() - isValid = config.get(nil, 'Lua.telemetry.enable') + local enable = config.get(nil, 'Lua.telemetry.enable') + assert(enable == true or enable == false or enable == nil) + isValid = enable if isValid == false then return end |