Only advertise semanticTokens if there's a handler#640
Merged
Conversation
Neovim 0.12 and above will make `semanticTokens` requests on every
cursor movement. Currently, the `lsp` library advertises
`semanticTokens` capabilities, even if the LSP server implemented with
this library doesn't a handler. This means that every time I move my
cursor I get a blocking error in my editor, making it essentially
unusable!
Let's only advertise the capability if there's a handler registered.
Here's a workaround in my Neovim config:
```
vim.lsp.config("hls", {
cmd = { "static-ls" },
on_init = function(client)
-- static-ls (via the `lsp` Haskell library) falsely advertises
-- semanticTokensProvider but registers no handler, producing a
-- "no handler for: textDocument/semanticTokens/full" message on
-- every cursor move. Strip it.
client.server_capabilities.semanticTokensProvider = nil
end,
})
```
josephsumabat
pushed a commit
to josephsumabat/static-ls
that referenced
this pull request
May 15, 2026
`lsp` falsely advertises `semanticTokens` capabilities, regardless of what we support. Register some no-op handlers so that clients which trust the LSP server don't crash out. See: haskell/lsp#640
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Neovim 0.12 and above will make
semanticTokensrequests on every cursor movement. Currently, thelsplibrary advertisessemanticTokenscapabilities, even if the LSP server implemented with this library doesn't a handler. This means that every time I move my cursor I get a blocking error in my editor, making it essentially unusable!Let's only advertise the capability if there's a handler registered.
Here's a workaround in my Neovim config: