summaryrefslogtreecommitdiff
path: root/script/provider
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-06-23 15:53:05 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-06-23 15:53:05 +0800
commitca632b4bbc66eea45e9cd90dccd6b7f895cac018 (patch)
treee06fae53d18996e0bda7881f7e440f0d722cb13e /script/provider
parent35e998442bc1b9ffade5531dac61220265c533f1 (diff)
downloadlua-language-server-ca632b4bbc66eea45e9cd90dccd6b7f895cac018.zip
use `semanticTokens/range` in VSCode
Diffstat (limited to 'script/provider')
-rw-r--r--script/provider/provider.lua50
1 files changed, 28 insertions, 22 deletions
diff --git a/script/provider/provider.lua b/script/provider/provider.lua
index 44805130..ac952715 100644
--- a/script/provider/provider.lua
+++ b/script/provider/provider.lua
@@ -909,29 +909,35 @@ local function toArray(map)
return array
end
-m.register 'textDocument/semanticTokens/full' {
- capability = {
- semanticTokensProvider = {
- legend = {
- tokenTypes = toArray(define.TokenTypes),
- tokenModifiers = toArray(define.TokenModifiers),
- },
- full = true,
- },
- },
- ---@async
- function (params)
- log.debug('textDocument/semanticTokens/full')
- local uri = files.getRealUri(params.textDocument.uri)
- workspace.awaitReady(uri)
- local _ <close> = progress.create(uri, lang.script.WINDOW_PROCESSING_SEMANTIC_FULL, 0.5)
- local core = require 'core.semantic-tokens'
- local results = core(uri, 0, math.huge)
- return {
- data = results
- }
+client.event(function (ev)
+ if ev == 'init' then
+ if not client.isVSCode() then
+ m.register 'textDocument/semanticTokens/full' {
+ capability = {
+ semanticTokensProvider = {
+ legend = {
+ tokenTypes = toArray(define.TokenTypes),
+ tokenModifiers = toArray(define.TokenModifiers),
+ },
+ full = true,
+ },
+ },
+ ---@async
+ function (params)
+ log.debug('textDocument/semanticTokens/full')
+ local uri = files.getRealUri(params.textDocument.uri)
+ workspace.awaitReady(uri)
+ local _ <close> = progress.create(uri, lang.script.WINDOW_PROCESSING_SEMANTIC_FULL, 0.5)
+ local core = require 'core.semantic-tokens'
+ local results = core(uri, 0, math.huge)
+ return {
+ data = results
+ }
+ end
+ }
+ end
end
-}
+end)
m.register 'textDocument/semanticTokens/range' {
capability = {