-
-
Notifications
You must be signed in to change notification settings - Fork 368
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
Support structured diagnostics 2 #4433
base: master
Are you sure you want to change the base?
Support structured diagnostics 2 #4433
Conversation
All failures in the jobs of e651d41 seem to be spurious (except for the stylish-haskell formatting failure). |
I think the remaining failures are not caused by this PR. Are these kinds of spurious failures common in HLS? Also, I would really like to get this merged before the next release, because I want to develop a VS Code extension which uses these diagnostic numbers. |
Yes, they unfortunately are |
Some errors in ghc |
You're right. Can anyone give me some tips on how to profile HLS to see where these timeouts are coming from? |
@noughtmare Profiling is likely not necessary, I think the tests are waiting for an LSP message that never arrives, and then just wait for 60s and time out. Use |
Ah, I was thinking there was some inefficiency somewhere that only GHC 9.6 and later could properly optimize. However, I think you're suggesting an alternative explanation: that one of the conditional CPP blocks contains an actual correctness issue. Perhaps I could just visually inspect those first; I don't think that would be that much work. Edit: no obvious loops or anything, so perhaps some tracing would indeed be better. |
I've decided to make the tests ignore all error codes on GHC 9.4. I think some errors already have codes in 9.4, so we could do a bit more, but I don't think it is worth the effort. |
The remaining MacOS failure seems like a compiler bug. The linker is throwing an error. Edit: https://gitlab.haskell.org/ghc/ghc/-/issues/24648 Adding the compiler flag |
@fendor do you think we could try setting the |
Oh, I see we already have that exact workaround in some places. I'll just copy that to the hlint plugin. |
Yay, it has finally passed CI! Should I squash the commits? I'm not sure what to write in the message as I don't really know the details of what exactly Dylan did. |
7773572
to
469d8a7
Compare
We're leaving the TODOs for either later in this PR or in another PR
I think the linked code is wrong, the benchmark isn't executed on each PR, see https://github.com/haskell/haskell-language-server/actions/runs/11481138334/job/31951108378?pr=4433, but only nightly or on demand. So good catch :) |
We need performance label to run the benchmark, see #4271. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work, just a few neatpicks and a question
Interesting, it seems the stack build converts more warnings to errors than the cabal build. |
I'm a bit confused, I see we now store the structured diagnostics for warnings from the typechecker in |
@wz1000 I think I removed that in 0776c65 (in response to #4433 (comment)), because we don't use it anywhere else yet and it would be very simple to add back when we do actually need it. |
Thank you for the reviews! I hope I have addressed all feedback appropriately. Is there anything more I can do to speed up the process of merging this? |
Probably not, except for regularly pinging on this thread to make sure we get enough reviews, soon :) We need two approvals, considering the importance of this change, we shouldn't rush merging it without proper review time. However, I hope we can merge it within the next two weeks (hopefully a pessimistic timeframe, but I don't really want to give any time estimate at all :D ). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a question, other places look good to me.
fdLspDiagnostic = | ||
lspDiag | ||
& attachReason (fmap (diagnosticReason . errMsgDiagnostic) mbOrigMsg) | ||
& setGhcCode mbOrigMsg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So all the MsgEnvelope
are converted to FileDiagnostic through this function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so, yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was actually looking at when this function is called with a Just
and couldn't easily find anything, because there are so many callers that pass along a value for which you then have to transitively search.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I found these now:
- https://github.com/haskell/haskell-language-server/pull/4433/files/0776c65490d8840d03ec8740f0c8048ea1d55b35#diff-9ec5d8d4031c00a406a3c0ce65ca9e155f3a05d7014a97469f89b5fd3bb65bb9R71
- https://github.com/haskell/haskell-language-server/pull/4433/files/0776c65490d8840d03ec8740f0c8048ea1d55b35#diff-d7140bbfca1b7aaafd8c82d1d6aa21a3f941eb27ba8f08e4d9fb13766b21b418R885
And those are the only two places. I've now checked every caller.
ping |
In the last HLS meeting, we discussed this PR and what we want from it, for transparency, these are the notes https://docs.google.com/document/d/1zqRhA3uoiYgA_Q8eDpIEG0OiFcofGqkVP7N4ODDmikM/edit?tab=t.0 In short, I will review soon and try to make use of the structured diagnostics in 1 or 2 of the plugins, to demonstrate how we can use them in the future and to make sure this PR takes the right directions. |
I'm fine with pushing directly to my branch if that is possible. Do I need to give you special permissions? |
I don't know, I will just try to push at some point and ping you if I have any trouble :) |
This is my attempt at finishing the work of @dylan-thinnes on !4311.
Addresses #2014
Should hopefully enable #3246
These are two things Dylan listed as work for future PRs:
Some future work discovered in reviews of this PR:
requireDiagnostic
could take a more structured error code query type as argument. See Support structured diagnostics 2 #4433 (comment)requireDiagnostics
and related functions use explicit error codes if possible