Skip to content

Neovim Autocomplete with HLS >= 2.1.0.0 throws error #3842

Closed
@CiaraMar

Description

@CiaraMar

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
2023-10-13-185958_1054x1055_escrotum

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.
2023-10-13-190118_1057x1058_escrotum

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.

Metadata

Metadata

Assignees

Labels

type: bugSomething isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions