aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/semantic_tokens.lua
diff options
context:
space:
mode:
authorfsouza <108725+fsouza@users.noreply.github.com>2022-12-10 06:16:33 -0500
committerGitHub <noreply@github.com>2022-12-10 12:16:33 +0100
commit6d37d8cb17390419360c1459607beac2d93183b6 (patch)
tree52c6019660731c79917529a82950579fca9b628c /runtime/lua/vim/lsp/semantic_tokens.lua
parentf96fb23de62f9539bf254cc1a4e99d1da8b71994 (diff)
downloadrneovim-6d37d8cb17390419360c1459607beac2d93183b6.tar.gz
rneovim-6d37d8cb17390419360c1459607beac2d93183b6.tar.bz2
rneovim-6d37d8cb17390419360c1459607beac2d93183b6.zip
fix(lsp): ignore null responses for semanticTokens request (#21364)
The spec indicates that the response may be `null`, but it doesn't really say what a `null` response means. Since neovim raises an error if the response is `null`, I figured that ignoring it would be the safest bet. Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
Diffstat (limited to 'runtime/lua/vim/lsp/semantic_tokens.lua')
-rw-r--r--runtime/lua/vim/lsp/semantic_tokens.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/runtime/lua/vim/lsp/semantic_tokens.lua b/runtime/lua/vim/lsp/semantic_tokens.lua
index 66e656abb6..83b414bf87 100644
--- a/runtime/lua/vim/lsp/semantic_tokens.lua
+++ b/runtime/lua/vim/lsp/semantic_tokens.lua
@@ -304,6 +304,11 @@ function STHighlighter:process_response(response, client, version)
-- reset active request
state.active_request = {}
+ -- skip nil responses
+ if response == nil then
+ return
+ end
+
-- if we have a response to a delta request, update the state of our tokens
-- appropriately. if it's a full response, just use that
local tokens