Which OS do you use?
Ubuntu
Which version of GHC do you use and how did you install it?
9.2.5 from ghcup
How is your project built (alternative: link to the project)?
Which LSP client (editor/plugin) do you use?
Neovim+LanguageClient-neovim
Which version of HLS do you use and how did you install it?
1.9.1.0 installed with mason.nvim LSP installer and handler plugin
Have you configured HLS in any way (especially: a hie.yaml file)?
no
Steps to reproduce
Create a .lhs file with following content
> f a = g a
> g = id
Now the first line should have a hint you can apply, namely Eta reduce.
Applying the code action results in the following exception:
[ERROR][2023-03-14 14:06:09] ...lsp/handlers.lua:485 "ReactorMessageActionException\nhaskell-language-server-9.2.5: panic! (the 'impossible' happened)\n (GHC version 9.2.5:\n\tapply\n\nparse error on input `>'\nCall stack:\n CallStack (from HasCallStack):\n callStackDoc, called at compiler/GHC/Utils/Panic.hs:181:37 in ghc:GHC.Utils.Panic\n pprPanic, called at src/Refact/Compat.hs:153:13 in apply-refact-0.12.0.0-6ade9c5a0135a7c47e9fe513b6d967bc72e88f692fb351d416614d8102db1de3:Refact.Compat\n\nPlease report this as a GHC bug: https://www.haskell.org/ghc/reportabug\n"
Expected behaviour
The hint is applied without any LSP throws an exception and the code is kept in
a working state without any errors. If the LSP is supposed to work in lhaskell
files, code actions should work too. I also noticed that applying code actions
like putting the type signature is applied but no > is put at the start of
the line, thus the .lhs file becomes invalid after applying the code action.
Actual behaviour
LHS throws a ReactorMessageActionException.
Debug information
[ERROR][2023-03-14 14:06:09] ...lsp/handlers.lua:485 "ReactorMessageActionException\nhaskell-language-server-9.2.5: panic! (the 'impossible' happened)\n (GHC version 9.2.5:\n\tapply\n\nparse error on input `>'\nCall stack:\n CallStack (from HasCallStack):\n callStackDoc, called at compiler/GHC/Utils/Panic.hs:181:37 in ghc:GHC.Utils.Panic\n pprPanic, called at src/Refact/Compat.hs:153:13 in apply-refact-0.12.0.0-6ade9c5a0135a7c47e9fe513b6d967bc72e88f692fb351d416614d8102db1de3:Refact.Compat\n\nPlease report this as a GHC bug: https://www.haskell.org/ghc/reportabug\n"
Based on the call stack, it looks like this is an upstream bug in apply-refact. If so, you should be able to reproduce by running hlint --refactor on the command line. If so, please report it upstream.
Your environment
Which OS do you use? Ubuntu Which version of GHC do you use and how did you install it? 9.2.5 from ghcup How is your project built (alternative: link to the project)?
Which LSP client (editor/plugin) do you use? Neovim+LanguageClient-neovim Which version of HLS do you use and how did you install it? 1.9.1.0 installed with mason.nvim LSP installer and handler plugin Have you configured HLS in any way (especially: a
hie.yaml
file)? noSteps to reproduce
Create a .lhs file with following content
Now the first line should have a
hint
you can apply, namelyEta reduce
. Applying the code action results in the following exception:Expected behaviour
The hint is applied without any LSP throws an exception and the code is kept in a working state without any errors. If the LSP is supposed to work in lhaskell files, code actions should work too. I also noticed that applying code actions like putting the type signature is applied but no
>
is put at the start of the line, thus the .lhs file becomes invalid after applying the code action.Actual behaviour
LHS throws a
ReactorMessageActionException
.Debug information