Skip to content
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

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

Open
Enayaaa opened this issue Mar 14, 2023 · 2 comments
Labels
status: blocked Not actionable, because blocked by upstream/GHC etc. type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@Enayaaa
Copy link

Enayaaa commented Mar 14, 2023

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"

@Enayaaa Enayaaa added status: needs triage type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. labels Mar 14, 2023
@michaelpj michaelpj added status: blocked Not actionable, because blocked by upstream/GHC etc. and removed status: needs triage labels Mar 22, 2023
@michaelpj
Copy link
Collaborator

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.

@michaelpj
Copy link
Collaborator

See also #689

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: blocked Not actionable, because blocked by upstream/GHC etc. type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
None yet
Development

No branches or pull requests

2 participants