Skip to content

Commit da86bcf

Browse files
committed
resolve #966
1 parent 77822ab commit da86bcf

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed

script/provider/provider.lua

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -871,10 +871,30 @@ m.register 'workspace/symbol' {
871871
end
872872
}
873873

874+
local function toArray(map)
875+
local array = {}
876+
for k in pairs(map) do
877+
array[#array+1] = k
878+
end
879+
table.sort(array, function (a, b)
880+
return map[a] < map[b]
881+
end)
882+
return array
883+
end
884+
874885
m.register 'textDocument/semanticTokens/full' {
875-
abortByFileUpdate = true,
886+
capability = {
887+
semanticTokensProvider = {
888+
legend = {
889+
tokenTypes = toArray(define.TokenTypes),
890+
tokenModifiers = toArray(define.TokenModifiers),
891+
},
892+
full = true,
893+
},
894+
},
876895
---@async
877896
function (params)
897+
log.debug('textDocument/semanticTokens/full')
878898
local uri = files.getRealUri(params.textDocument.uri)
879899
workspace.awaitReady(uri)
880900
local _ <close> = progress.create(scope.getScope(uri), lang.script.WINDOW_PROCESSING_SEMANTIC_FULL, 0.5)
@@ -886,18 +906,6 @@ m.register 'textDocument/semanticTokens/full' {
886906
end
887907
}
888908

889-
local function toArray(map)
890-
local array = {}
891-
for k in pairs(map) do
892-
array[#array+1] = k
893-
end
894-
table.sort(array, function (a, b)
895-
return map[a] < map[b]
896-
end)
897-
return array
898-
end
899-
900-
901909
m.register 'textDocument/semanticTokens/range' {
902910
capability = {
903911
semanticTokensProvider = {
@@ -906,7 +914,6 @@ m.register 'textDocument/semanticTokens/range' {
906914
tokenModifiers = toArray(define.TokenModifiers),
907915
},
908916
range = true,
909-
full = false,
910917
},
911918
},
912919
---@async

0 commit comments

Comments
 (0)