haskell-language-server icon indicating copy to clipboard operation
haskell-language-server copied to clipboard

Request textDocument/semanticTokens/full failed

Open QuantumStatic opened this issue 1 year ago • 9 comments

Your environment

Which OS do you use? MacOS Which version of GHC do you use and how did you install it? 9.4.8 / GHCup How is your project built (alternative: link to the project)?

Which LSP client (editor/plugin) do you use? VS Code with Haskell Plugin Which version of HLS do you use and how did you install it? 2.5.0.0 from GHCup Have you configured HLS in any way (especially: a hie.yaml file)? No

What's wrong?

2024-02-16T18:21:53.031955Z | Warning | No plugin handles this "textDocument/semanticTokens/full" request.
[Error - 13:21:53] Request textDocument/semanticTokens/full failed.
  Message: No plugins are available to handle this SMethod_TextDocumentSemanticTokensFull request.
 Plugins installed for this method, but not available to handle this request are:
semanticTokens is disabled globally in your config.
  Code: -32601 

This is the error I get and however the server is running as the process shows up in my activity monitor.

Screenshot 2024-02-16 at 1 34 52 PM

Debug information

QuantumStatic avatar Feb 16 '24 18:02 QuantumStatic

Hi, thank you for the bug report!

We recently added support for semantic tokens, but the plugin taking care of that feature is disabled by default. Unfortunately, the lsp client will still request the semantic tokens as we advertise that we are capable of the feature to the lsp client. The semantic token request fails, since the plugin isn't enabled, and we log why the request failed. However, HLS works perfectly fine, and is merely more verbose than strictly necessary.

fendor avatar Feb 16 '24 18:02 fendor

How do I enable the support for semantic tokens?

QuantumStatic avatar Feb 16 '24 21:02 QuantumStatic

In VSCode: File > Preferences > Settings type "semantic tokens" in the search box and one of the settings it finds should be a checkox "Enable semanticTokens plugin".

You might need to restart hls or extension host (more radical, that's what I usually do) for this change to take an effect (ctrp+shift+p - type restart extension host and pick the option it finds)

jhrcek avatar Feb 17 '24 06:02 jhrcek

In theory, not even restarting should be necessary :sweat_smile:

fendor avatar Feb 17 '24 12:02 fendor

Hmm, this is a bit suboptimal. I guess in an ideal world in this case we would not advertise support for semantic tokens and instead dynamically register for it when you turn it on. But that's a fair bit of work.

michaelpj avatar Feb 18 '24 20:02 michaelpj

I made https://github.com/haskell/haskell-language-server/issues/4084 for the wider issue.

michaelpj avatar Feb 18 '24 20:02 michaelpj

This does solve my issue. Thank You!

QuantumStatic avatar Feb 19 '24 20:02 QuantumStatic