New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Semantic highlighting doesn't work on language servers containing non-alphanumeric characters in token types #21391
Comments
That's some very illegal naming... That can't work with the current implementation at all. Best advice is to disable tokens for this server. |
A workaround as a user could probably be to manipulate |
We could also sanitize or skip such invalid token highlights, but I worry about performance here @jdrouhard |
If we sanitize the legend like @theHamsta suggested, we would only incur the performance cost once, at client start-up time. This seems like a good idea regardless, we could replace any non alpha-numeric with an underscore. Easy to document, easy to implement. However, for this particular language server, those are just flat out wrong. There should be a bug filed against it to make the legend conform to the spec. |
My interpretation of the spec is that a server isn't supposed to send token types which aren't part of the clients capabilities. Otherwise there wouldn't be any point in having the capability that lists the supported types. I don't think we should do any kind of sanitation, but instead file bug reports to the language servers to get them fixed. |
Thanks for the responses. I'll create an issue in the OmniSharp repo to let them know about the incorrect token naming. |
Just in case anyone needs quick and dirty fix, I'm sharing what I've put to my
UPD: replaced previous version because of errors on first buffer opening. |
Neovim version (nvim -v)
NVIM v0.9.0-dev-496+g1c324cb19 commit 1c324cb
Language server name/version
omnisharp-roslyn v1.39.2 and any other language server with non-alphanumeric tokens
Operating system/version
Windows 11
Steps to reproduce using "nvim -u minimal_init.lua"
Start the omnisharp-rosyln language server and see the errors described below
Expected behavior
Semantic highlighting works
Actual behavior
Semantic highlighting doesn't work and produces the following error:
This is the contents of the client.server_capabilities.semanticTokensProvider table where you can see the non-alphanumeric token types:
Log file
No response
The text was updated successfully, but these errors were encountered: