Skip to content

LSP throws exception if a code action is applied in a lhaskell file where the line starts with a > #3523

Open
@Enayaaa

Description

@Enayaaa

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)?
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"

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: blockedNot actionable, because blocked by upstream/GHC etc.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