-
-
Notifications
You must be signed in to change notification settings - Fork 389
Improve the error message when there is a typo in the Cabal file #4336
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
Thank you for the bug report! We should log the stderr if the command fails! |
Thank you, that would help! I wonder, are there any circumstances where, |
I think the problem is that this comes before HLS has even started up, and we're trying to interrogate cabal to find out the version of GHC so we can actually launch the right HLS. |
If I'm reading this correctly, this is already the behavior? The problem would therefore be that it's not sent to the client? Here's what I see in emacs/eglot:
|
I am not sure, but it looks like we are not logging the stderr of |
In my case, I can also see the stderr:
|
Hm, thanks for checking, you are right, I have this as well! Then this issue seems to be purely about the behaviour of |
Are you thinking something like this?
|
Yes, exactly! |
Fixed by #4387 |
Thank you very much for fixing this! ❤️ |
Your environment
Which OS do you use?
Ubuntu 24.04 + Nix flakes (Nix 2.21.2)
Which version of GHC do you use and how did you install it?
GHC 9.6.4 installed via devenv and Flakes, using
languages.haskell.enable = true;
documentationHow is your project built?
I haven't reached a point where that is a concern
Which LSP client (editor/plugin) do you use?
VS Code + vscode-haskell
Which version of HLS do you use and how did you install it?
haskell-language-server version: 2.7.0.0 (GHC: 9.6.4), installed with GHC.
Have you configured HLS in any way (especially: a
hie.yaml
file)?No. However, I configured vscode-haskell to look for HLS on the
PATH
and to not try downloading itSteps to reproduce
Have a Cabal file with a small typo in it, for example:
See this error in VSCode:
Run
haskell-language-server-wrapper --probe-tools
and get something like:Expected behaviour
Haskell Language Server should return an error message pointing to the actual problem, for example:
This points the user in the right direction, and it's obvious what they should do to fix the error.
Actual behaviour
The current error message leads the user on a wild goose chase, trying to figure out why
ghc
is in theirPATH
but not their project. For example, I was hunting down ways to specify a GHC version/path infoobar.cabal
.The second part of the message points to the source of the error, but the first part is just confusing for the user. I understand the first part isn't wrong, it's what Haskell Language Server was doing when it hit an error condition, but Haskell Language Server could be better about checking for errors in the
.cabal
file up-front, and reporting them early.The text was updated successfully, but these errors were encountered: