lsp-mode
lsp-mode copied to clipboard
How to debig semantic highlighting not showing up?
Thank you for the bug report
- [X] I am using the latest version of
lsp-mode
related packages. - [X] I checked FAQ and Troubleshooting sections
- [X] You may also try reproduce the issue using clean environment using the following command
emacs -q -l lsp-start-plain.el
where lsp-start-plain.el
can be downloaded here.
Bug description
I'm looking for advice on how to debug semantic highlighting not being shown for a Language Server I am helping to develop. The highlighting seem to work in other editors, so the problem must be how we're interacting with Emacs somehow.
Steps to reproduce
I'm more looking for help debugging, since I'm not expecting the devs to build and install an the idris2-lsp server, but here's the info:
Prereq: idris2-lsp
built and on $PATH: https://github.com/idris-community/idris2-lsp
Config: lsp-start-plain.el
with the following lines added
(add-to-list 'lsp-language-id-configuration '(".*\\.idr$" . "idris2"))
(lsp-register-client
(make-lsp-client
:new-connection (lsp-stdio-connection "idris2-lsp")
:major-modes '(fundamental-mode)
:server-id 'idris2-lsp))
(setq lsp-semantic-tokens-enable t)
File: Hello.idr
plus : Nat -> Nat -> Nat
plus x y = x + y
Expected behavior
The file is highlighted with semantic highlighting.
Which Language Server did you use?
There is no highlighting, even though info is being sent from the server.
The server's stderr output shows that this is what's being sent:
LOG INFO:Communication.Channel: Received request for method "textDocument/semanticTokens/full"
LOG DEBUG:Notification.SemanticTokens: Fetching semantic highlightning metadata
LOG DEBUG:Notification.SemanticTokens: Fetching semantic aliases metadata
LOG DEBUG:Notification.SemanticTokens: Fetching semantic defaults metadata
LOG DEBUG:Notification.SemanticTokens: Removing overlapping tokens
LOG DEBUG:Notification.SemanticTokens: Splitting multiline tokens
LOG DEBUG:Notification.SemanticTokens: Encoding semantic tokens
LOG INFO:Communication.Channel: Sent response message for method "textDocument/semanticTokens/full"
LOG DEBUG:Communication.Channel: Response sent: {"jsonrpc":"2.0","id":2,"result":{"data":[0,0,4,4,0,0,5,3,0,0,0,4,1,4,0,0,2,4,0,0,2,0,4,1,0,0,5,1,4,0,0,2,3,0,0,0,4,2,4,0,0,3,3,0,0,0,4,2,4,0,0,3,3,0,0,0,4,2,4,0,0,3,3,0,0,1,0,4,1,0,0,5,1,3,0,0,2,1,3,0,0,2,1,3,0,0,2,1,4,0,0,2,1,3,0,0,2,1,1,0,0,2,1,3,0]}}
LOG DEBUG:Communication.Channel: Received message: {"jsonrpc":"2.0","method":"$/cancelRequest","params":{"id":2}}
OS
Linux
Error callstack
No response
Anything else?
Basically, I'm looking for advice for how to debug this. I was directed here by @ericdallo on Discord, and told to ping @sebastiansturm.
Are there flags I can turn on to see what's happening inside the semantic highlighting, and to see why it's receiving the data but not highlighting based on it? Is there anything obviously wrong in the data being sent? I tried to do a small file but unfortunately it's still a big array.