summaryrefslogtreecommitdiff
path: root/script/provider/semantic-tokens.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-01-29 14:50:06 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-01-29 14:50:06 +0800
commit4556d55e6e944f122db9cbb8c4d126d43dc8710d (patch)
treea04e44c0d22e28ac91d7c742c4d33bc4db27e115 /script/provider/semantic-tokens.lua
parent84f00693304a934ffbd86aa48d35245d6277ea68 (diff)
downloadlua-language-server-4556d55e6e944f122db9cbb8c4d126d43dc8710d.zip
help makes semantic tokens effect
Diffstat (limited to 'script/provider/semantic-tokens.lua')
-rw-r--r--script/provider/semantic-tokens.lua33
1 files changed, 33 insertions, 0 deletions
diff --git a/script/provider/semantic-tokens.lua b/script/provider/semantic-tokens.lua
index e4b2fc6f..76fede85 100644
--- a/script/provider/semantic-tokens.lua
+++ b/script/provider/semantic-tokens.lua
@@ -2,6 +2,8 @@ local proto = require 'proto'
local define = require 'proto.define'
local client = require 'provider.client'
local json = require "json"
+local config = require 'config'
+local lang = require 'language'
local isEnable = false
@@ -16,6 +18,7 @@ local function toArray(map)
return array
end
+local dontShowAgain = false
local function enable()
if isEnable then
return
@@ -41,6 +44,36 @@ local function enable()
},
}
})
+ if config.other.semantic ~= true and not dontShowAgain then
+ local item = proto.awaitRequest('window/showMessageRequest', {
+ type = define.MessageType.Info,
+ message = lang.script.WINDOW_CHECK_SEMANTIC,
+ actions = {
+ {
+ title = lang.script.WINDOW_APPLY_SETTING,
+ },
+ {
+ title = lang.script.WINDOW_DONT_SHOW_AGAIN,
+ },
+ }
+ })
+ if item then
+ if item.title == lang.script.WINDOW_APPLY_SETTING then
+ proto.notify('$/command', {
+ command = 'lua.config',
+ data = {
+ key = 'editor.semanticHighlighting.enabled',
+ action = 'set',
+ value = true,
+ global = true,
+ }
+ })
+ end
+ if item.title == lang.script.WINDOW_DONT_SHOW_AGAIN then
+ dontShowAgain = true
+ end
+ end
+ end
end
local function disable()