summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsumneko <sumneko@hotmail.com>2022-02-17 13:54:17 +0800
committersumneko <sumneko@hotmail.com>2022-02-17 13:54:17 +0800
commitba55a9f6dbf57b5b9ec38f1978caa7178f44f13d (patch)
treeff48e3916e9295ee8a7200bd1213f73bd4aad9d4
parent12d6a9eb75f31b64cbc89eb3265805bc8dad01f0 (diff)
downloadlua-language-server-ba55a9f6dbf57b5b9ec38f1978caa7178f44f13d.zip
`FIX` telemetry is not disabled by default
-rw-r--r--changelog.md1
-rw-r--r--script/client.lua4
-rw-r--r--script/config/config.lua2
-rw-r--r--script/service/telemetry.lua8
4 files changed, 9 insertions, 6 deletions
diff --git a/changelog.md b/changelog.md
index f689713c..5d1454d0 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,6 +1,7 @@
# changelog
## 2.6.5
+* `FIX` telemetry is not disabled by default
* `FIX` [#934](https://github.com/sumneko/lua-language-server/issues/934)
* `FIX` [#952](https://github.com/sumneko/lua-language-server/issues/952)
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