summaryrefslogtreecommitdiff
path: root/script/provider
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-03-01 14:21:58 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-03-01 14:21:58 +0800
commitda86bcf172a1db3f1db18971ba58910696b0a596 (patch)
tree9aeb9cee54933c9e18c46570469dd56d75bf9886 /script/provider
parent77822abb0689a1867477c592fd61d97020167926 (diff)
downloadlua-language-server-da86bcf172a1db3f1db18971ba58910696b0a596.zip
resolve #966
Diffstat (limited to 'script/provider')
-rw-r--r--script/provider/provider.lua35
1 files changed, 21 insertions, 14 deletions
diff --git a/script/provider/provider.lua b/script/provider/provider.lua
index 3e8fec24..5ee99b3e 100644
--- a/script/provider/provider.lua
+++ b/script/provider/provider.lua
@@ -871,10 +871,30 @@ m.register 'workspace/symbol' {
end
}
+local function toArray(map)
+ local array = {}
+ for k in pairs(map) do
+ array[#array+1] = k
+ end
+ table.sort(array, function (a, b)
+ return map[a] < map[b]
+ end)
+ return array
+end
+
m.register 'textDocument/semanticTokens/full' {
- abortByFileUpdate = true,
+ 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(scope.getScope(uri), lang.script.WINDOW_PROCESSING_SEMANTIC_FULL, 0.5)
@@ -886,18 +906,6 @@ m.register 'textDocument/semanticTokens/full' {
end
}
-local function toArray(map)
- local array = {}
- for k in pairs(map) do
- array[#array+1] = k
- end
- table.sort(array, function (a, b)
- return map[a] < map[b]
- end)
- return array
-end
-
-
m.register 'textDocument/semanticTokens/range' {
capability = {
semanticTokensProvider = {
@@ -906,7 +914,6 @@ m.register 'textDocument/semanticTokens/range' {
tokenModifiers = toArray(define.TokenModifiers),
},
range = true,
- full = false,
},
},
---@async