-
-
Notifications
You must be signed in to change notification settings - Fork 391
Neovim Autocomplete with HLS >= 2.1.0.0 throws error #3842
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
Comments
Hi, thank you for your bug report! Maybe @joyfulmantis knows what this is about. |
Edit: Ah, this might not be what I'm describing (which looks identical to this: #3535 (comment)) This might be the same as what I'm seeing also in nvim (with coc.nvim). The provenance and docs for symbols are only shown (and updated) for already imported symbols. So if I start typeing Here's a snipped from the log, many such messages repeated.
and from the server log (same thing more or less)
And the full session log: Details
|
It should be easy enough to get HLS to bounce resolve requests we don't want to answer instead of failing them. It feels a bit incorrect, but probably worth it if our current behavior is causing problems with editors. I'll try to get a PR out this week for it. |
Hmm, the error we get back also seems misleading, about no plugins being enabled? I also think there's a lsp parsing bug lurking here perhaps. |
These are completion request with an empty data field, and so we reject them outright. Certainly nicer rejection messages would be nice, but I think it what we currently show for these sort of request rejections. |
Also, this looks like a client bug to me. It's not legal to pass
|
That's a shame. It's really not comprehensible to the user, I think... |
I get this same error when trying to apply code actions in neovim |
Code actions and completions work quite differently. @cdimitroulas could you create a new bug report with logs and specific details? |
@joyfulmantis improved the error messages, and the next |
Your environment
Which OS do you use?
Arch Linux
Which version of GHC do you use and how did you install it?
9.0.2 ghcup
How is your project built (alternative: link to the project)?
cabal
Which LSP client (editor/plugin) do you use?
Neovim + haskell-tools + nvim_coq
(All latest)
Which version of HLS do you use and how did you install it?
Version 2.1.0.0 (Though I've tried all the way up to 2.4.0.0)
Version 2.0.0.1 does work for me
Installed via ghcup
Have you configured HLS in any way (especially: a
hie.yaml
file)?no
Steps to reproduce
cabal init
cabal build
nvim app/Main.hs
wait for server to load
type in fm and wait for fmap to show up
tab to the "fmap" that has "LSP" on the side
(see pics below) for more
Expected behaviour
It should complete or show various info on it

Actual behaviour
When hovering over on autocomplete of a name, and the name has "LSP" on the side it pops up a window with an error.

This does not occur if on the right side it is a "BUF" based suggestion.
Debug information
HLS log
2023-10-13T23:42:21.023882Z | Error | LSP: incoming message parse error:
Error in $.params.insertTextMode: parsing Integer failed, expected Number, but encountered Null
when processing
{"method":"completionItem/resolve","params":{"label":"spark#","detail":"from GHC.Base","sortText":"05","data":null,"insertTextMode":null,"insertTextFormat":1,"documentation":{"kind":"markdown","value":"Defined in 'GHC.Base'\n"},"command":{"arguments":[{"doc":"file:///home/maeve/projects/haskell/algorithm-design/app/Main.hs","importName":"GHC.Base","newThing":"spark#"}],"command":"404320:ghcide-extend-import-action:extendImport","title":"extend import"},"kind":3},"id":6,"jsonrpc":"2.0"}
I believe it might have something to do with the insertTextMode in plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal/Completion/Completer/Simple.hs
insertTestMode Specification (Might be wrong version for nvim):
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#insertTextMode
Error seems to refer to the text mode not being an integer or number as expected in the specification above.
The text was updated successfully, but these errors were encountered: