summaryrefslogtreecommitdiff
path: root/script/service
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-07-05 20:14:13 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-07-05 20:14:13 +0800
commit0d3dce5321332022552fca038e2e2d35985235c6 (patch)
tree841813a24eee3c44f7a162a53ebeb5c17a4d012a /script/service
parentb578d3d0c16f992e29657c3cad8ef9c3dd7d6a2c (diff)
downloadlua-language-server-0d3dce5321332022552fca038e2e2d35985235c6.zip
cleanup
Diffstat (limited to 'script/service')
-rw-r--r--script/service/telemetry.lua73
1 files changed, 29 insertions, 44 deletions
diff --git a/script/service/telemetry.lua b/script/service/telemetry.lua
index f3a3cf12..c45320c7 100644
--- a/script/service/telemetry.lua
+++ b/script/service/telemetry.lua
@@ -102,50 +102,35 @@ function m.updateConfig()
m.hasShowedMessage = true
await.call(function ()
- if client.isVSCode() then
- 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
- proto.notify('$/command', {
- command = 'lua.config',
- data = {
- key = 'Lua.telemetry.enable',
- action = 'set',
- value = true,
- global = true,
- }
- })
- elseif item.title == disableTitle then
- proto.notify('$/command', {
- command = 'lua.config',
- data = {
- key = 'Lua.telemetry.enable',
- action = 'set',
- value = false,
- global = true,
- }
- })
- end
- else
- proto.notify('window/showMessage', {
- message = lang.script.WINDOW_TELEMETRY_HINT,
- type = define.MessageType.Info,
- })
+ 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('Lua.telemetry.enable'
+ , 'set'
+ , true
+ , true
+ )
+ elseif item.title == disableTitle then
+ client.setConfig('Lua.telemetry.enable'
+ , 'set'
+ , false
+ , true
+ )
end
end)
end