summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelog.md1
-rw-r--r--doc/en-us/config.md33
-rw-r--r--doc/pt-br/config.md33
-rw-r--r--doc/zh-cn/config.md33
-rw-r--r--doc/zh-tw/config.md33
-rw-r--r--script/config/template.lua1
-rw-r--r--script/service/init.lua1
-rw-r--r--script/service/telemetry.lua203
-rw-r--r--tools/configuration.lua2
9 files changed, 65 insertions, 275 deletions
diff --git a/changelog.md b/changelog.md
index abf1129e..8c563ba8 100644
--- a/changelog.md
+++ b/changelog.md
@@ -9,6 +9,7 @@
* `CHG` definition: supports finding definitions for `@class` and `@alias`, since they may be defined multi times
* `CHG` rename: supports `@field`
* `CHG` improve patch for `.luarc.json`
+* `CHG` remove telemetry
* `FIX` [#831]
* `FIX` [#1729]
* `FIX` [#1737]
diff --git a/doc/en-us/config.md b/doc/en-us/config.md
index 28fd118e..b20e8bce 100644
--- a/doc/en-us/config.md
+++ b/doc/en-us/config.md
@@ -1,3 +1,19 @@
+# codeLens.enable
+
+Enable code lens.
+
+## type
+
+```ts
+boolean
+```
+
+## default
+
+```jsonc
+false
+```
+
# completion.autoRequire
When the input looks like a file name, automatically `require` this file.
@@ -1925,23 +1941,6 @@ Array<string>
[]
```
-# telemetry.enable
-
-Enable telemetry to send your editor information and error logs over the network. Read our privacy policy [here](https://github.com/sumneko/lua-language-server/wiki/Home#privacy).
-
-
-## type
-
-```ts
-boolean | null
-```
-
-## default
-
-```jsonc
-null
-```
-
# type.castNumberToInteger
Allowed to assign the `number` type to the `integer` type.
diff --git a/doc/pt-br/config.md b/doc/pt-br/config.md
index aa9bd81e..5365f204 100644
--- a/doc/pt-br/config.md
+++ b/doc/pt-br/config.md
@@ -1,3 +1,19 @@
+# codeLens.enable
+
+Enable code lens.
+
+## type
+
+```ts
+boolean
+```
+
+## default
+
+```jsonc
+false
+```
+
# completion.autoRequire
When the input looks like a file name, automatically `require` this file.
@@ -1925,23 +1941,6 @@ Array<string>
[]
```
-# telemetry.enable
-
-Enable telemetry to send your editor information and error logs over the network. Read our privacy policy [here](https://github.com/sumneko/lua-language-server/wiki/Home#privacy).
-
-
-## type
-
-```ts
-boolean | null
-```
-
-## default
-
-```jsonc
-null
-```
-
# type.castNumberToInteger
Allowed to assign the `number` type to the `integer` type.
diff --git a/doc/zh-cn/config.md b/doc/zh-cn/config.md
index 3cde1608..1516f4b0 100644
--- a/doc/zh-cn/config.md
+++ b/doc/zh-cn/config.md
@@ -1,3 +1,19 @@
+# codeLens.enable
+
+启用代码度量。
+
+## type
+
+```ts
+boolean
+```
+
+## default
+
+```jsonc
+false
+```
+
# completion.autoRequire
输入内容看起来是个文件名时,自动 `require` 此文件。
@@ -1924,23 +1940,6 @@ Array<string>
[]
```
-# telemetry.enable
-
-启用遥测,通过网络发送你的编辑器信息与错误日志。在[此处](https://github.com/sumneko/lua-language-server/wiki/Home#privacy)阅读我们的隐私声明。
-
-
-## type
-
-```ts
-boolean | null
-```
-
-## default
-
-```jsonc
-null
-```
-
# type.castNumberToInteger
允许将 `number` 类型赋给 `integer` 类型。
diff --git a/doc/zh-tw/config.md b/doc/zh-tw/config.md
index 636cdd1a..ea550ed1 100644
--- a/doc/zh-tw/config.md
+++ b/doc/zh-tw/config.md
@@ -1,3 +1,19 @@
+# codeLens.enable
+
+Enable code lens.
+
+## type
+
+```ts
+boolean
+```
+
+## default
+
+```jsonc
+false
+```
+
# completion.autoRequire
輸入內容看起來是個檔名時,自動 `require` 此檔案。
@@ -1924,23 +1940,6 @@ Array<string>
[]
```
-# telemetry.enable
-
-啟用遙測,透過網路發送你的編輯器資訊與錯誤日誌。在[此處](https://github.com/sumneko/lua-language-server/wiki/Home#privacy)閱讀我們的隱私聲明。
-
-
-## type
-
-```ts
-boolean | null
-```
-
-## default
-
-```jsonc
-null
-```
-
# type.castNumberToInteger
允許將 `number` 類型賦值給 `integer` 類型。
diff --git a/script/config/template.lua b/script/config/template.lua
index f8521ffe..6d680ea0 100644
--- a/script/config/template.lua
+++ b/script/config/template.lua
@@ -385,7 +385,6 @@ local template = {
auto_complete_table_sep = "true"
},
['Lua.spell.dict'] = Type.Array(Type.String),
- ['Lua.telemetry.enable'] = Type.Or(Type.Boolean >> false, Type.Nil) >> nil,
['Lua.misc.parameters'] = Type.Array(Type.String),
['Lua.misc.executablePath'] = Type.String,
['Lua.type.castNumberToInteger'] = Type.Boolean >> true,
diff --git a/script/service/init.lua b/script/service/init.lua
index 09204c84..eb0bd057 100644
--- a/script/service/init.lua
+++ b/script/service/init.lua
@@ -1,4 +1,3 @@
-require 'service.telemetry'
local service = require 'service.service'
return service
diff --git a/script/service/telemetry.lua b/script/service/telemetry.lua
deleted file mode 100644
index 211dff0e..00000000
--- a/script/service/telemetry.lua
+++ /dev/null
@@ -1,203 +0,0 @@
-local net = require 'service.net'
-local timer = require 'timer'
-local config = require 'config'
-local client = require 'client'
-local nonil = require 'without-check-nil'
-local util = require 'utility'
-local platform = require 'bee.platform'
-local proto = require 'proto.proto'
-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)
-if not token then
- token = ('%016X'):format(math.random(0, math.maxinteger))
- util.saveFile(tokenPath, token)
-end
-
-log.debug('Telemetry Token:', token)
-
-local function getClientName()
- nonil.enable()
- local clientName = client.info.clientInfo.name
- local clientVersion = client.info.clientInfo.version
- nonil.disable()
- return table.concat({clientName, clientVersion}, ' ')
-end
-
-local function send(link, msg)
- link:write(('s4'):pack(msg))
-end
-
-local function pushClientInfo(link)
- send(link, string.pack('zzz'
- , 'pulse'
- , token
- , getClientName()
- ))
-end
-
-local function pushPlatformInfo(link)
- send(link, string.pack('zzzzz'
- , 'platform'
- , token
- , ('%s %s'):format(platform.OS, platform.Arch)
- , ('%s %s'):format(platform.CRT, platform.CRTVersion)
- , ('%s %s'):format(platform.Compiler, platform.CompilerVersion)
- ))
-end
-
-local function pushVersion(link)
- send(link, string.pack('zzz'
- , 'version'
- , token
- , version.getVersion()
- ))
-end
-
-local function occlusionPath(str)
- return str:gsub('(%s*)([^:"\'%<%[%]\r\n]+)', function (left, chunk)
- if not chunk:find '[/\\]' then
- return
- end
- local newStr, count = chunk:gsub('.+([/\\]script[/\\])', '***%1')
- if count > 0 then
- return left .. newStr
- elseif chunk:sub(1, 1) == '\\'
- or chunk:sub(1, 1) == '/'
- or chunk:sub(1, 3) == '...' then
- return left .. '***'
- end
- end)
-end
-
-local function pushErrorLog(link)
- local err = log.firstError
- if not err then
- return
- end
- log.firstError = nil
- err = occlusionPath(err)
- send(link, string.pack('zzzz'
- , 'error'
- , token
- , getClientName()
- , ('%q'):format(err)
- ))
-end
-
----@type boolean?
-local isValid = false
-
-timer.wait(5, function ()
- timer.loop(300, function ()
- if isValid ~= true then
- return
- end
- local suc, link = pcall(net.connect, 'tcp', 'moe-moe.love', 11577)
- if not suc then
- suc, link = pcall(net.connect, 'tcp', '154.23.191.39', 11577)
- end
- if not suc or not link then
- return
- end
- function link:on_connect()
- pushClientInfo(link)
- pushPlatformInfo(link)
- pushVersion(link)
- pushErrorLog(link)
- self:close()
- end
- end)()
- timer.loop(1, function ()
- if isValid ~= true then
- return
- end
- net.update()
- end)
-end)
-
-local m = {}
-
-function m.updateConfig()
- 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
- for _, scp in ipairs(ws.folders) do
- if config.get(scp.uri, 'Lua.telemetry.enable') == false then
- isValid = false
- return
- end
- end
- for _, scp in ipairs(ws.folders) do
- if config.get(scp.uri, 'Lua.telemetry.enable') == true then
- isValid = true
- break
- end
- end
- if isValid ~= nil then
- return
- end
- if not client.getOption 'changeConfiguration' then
- return
- end
- if m.hasShowedMessage then
- return
- end
- m.hasShowedMessage = true
-
- await.call(function () ---@async
- local enableTitle = lang.script.WINDOW_TELEMETRY_ENABLE
- local disableTitle = lang.script.WINDOW_TELEMETRY_DISABLE
- local item = proto.awaitRequest('window/showMessageRequest', {
- message = lang.script.WINDOW_TELEMETRY_HINT,
- type = define.MessageType.Info,
- actions = {
- {
- title = enableTitle,
- },
- {
- title = disableTitle,
- },
- }
- })
- if not item then
- return
- end
- if item.title == enableTitle then
- client.setConfig {
- {
- key = 'Lua.telemetry.enable',
- action = 'set',
- value = true,
- global = true,
- }
- }
- elseif item.title == disableTitle then
- client.setConfig {
- {
- key = 'Lua.telemetry.enable',
- action = 'set',
- value = false,
- global = true,
- }
- }
- end
- end)
-end
-
-config.watch(function (uri, key, value)
- if key == 'Lua.telemetry.enable'
- or key == '' then
- m.updateConfig()
- end
-end)
-
-return m
diff --git a/tools/configuration.lua b/tools/configuration.lua
index 285ac334..b152927f 100644
--- a/tools/configuration.lua
+++ b/tools/configuration.lua
@@ -120,6 +120,4 @@ for name, temp in pairs(template) do
::CONTINUE::
end
-config['Lua.telemetry.enable'].tags = { 'telemetry' }
-
return config