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

Infer ranges #373

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

chrismwendt
Copy link
Contributor

Some GHC error messages have range info:

foo/Bar.hs:23:4-6: error: ...

And some don't, but they have annotations:

foo/Bar.hs:23:4: error:
...
   |
57 |         run source srv
   |             ^^^^^^

This PR parses the ^^^ annotations to infer range info so that the red squiggles show up on the whole range in VS Code, not just the first character.

In the process, I had to do some housekeeping: update TypeScript, mocha, migrate to @vscode/test-electron, etc.

cc @ndmitchell

@chrismwendt
Copy link
Contributor Author

@ndmitchell It looks like the copyright year is out of date in CI:

https://github.com/ndmitchell/ghcid/actions/runs/4345680401/jobs/7590729342?pr=373#step:7:105

@ndmitchell
Copy link
Owner

Thanks for the patch. Should GHC HQ be adding the range if they clearly know it? It seems a bit weird to parse it out of the string. Have you reported this upstream?

I actually don't use the IDE extension anymore. So if you want to take over maintainership of this extension, you'd be most welcome to do so.

@ndmitchell
Copy link
Owner

Also, I wonder if this range inference should be in the Haskell side, if we do want to have it?

@chrismwendt
Copy link
Contributor Author

Including the range info would be convenient for parsing, but on the other hand redundant with the annotation. I haven't reported this upstream since parsing makes it work on existing GHC versions.

I've been using HLS more recently and I don't use the ghcid IDE features much anymore either, so I don't think I'd be a responsive maintainer.

Also, I wonder if this range inference should be in the Haskell side, if we do want to have it?

Do you mean ghcid would read the GHC output, parse it, infer ranges, append the range info to errors, then print the augmented errors? I suppose the other plugins (nvim, emacs) would benefit from the info, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants