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

Support structured diagnostics 2 #4433

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

Conversation

noughtmare
Copy link
Contributor

This is my attempt at finishing the work of @dylan-thinnes on !4311.

Addresses #2014

Should hopefully enable #3246

We're leaving the TODOs for either later in this PR or in another PR
Had to move `attachReason` between modules to achieve this, which is
fine because it was never exported from its own module.
@noughtmare
Copy link
Contributor Author

All failures in the jobs of e651d41 seem to be spurious (except for the stylish-haskell formatting failure).

@noughtmare
Copy link
Contributor Author

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.

@fendor
Copy link
Collaborator

fendor commented Oct 18, 2024

Are these kinds of spurious failures common in HLS?

Yes, they unfortunately are

@fendor
Copy link
Collaborator

fendor commented Oct 18, 2024

Some errors in ghc 9.4 seem to be genuine, though. Many tests are seemingly time outing for some reason.

@noughtmare
Copy link
Contributor Author

You're right. Can anyone give me some tips on how to profile HLS to see where these timeouts are coming from?

@fendor
Copy link
Collaborator

fendor commented Oct 18, 2024

@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 HLS_TEST_LOG_STDERR=1 cabal test ... and TASTY_PATTERN to run a specific test with all HLS logging enabled.
Printf debugging also works quite well to figure out where the tests gets stuck.
To get the raw LSP messages, you can use LSP_TEST_LOG_MESSAGES=1 or LSP_TEST_LOG_STDERR=1 (they do the same thign)

@noughtmare
Copy link
Contributor Author

noughtmare commented Oct 18, 2024

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.


#if MIN_VERSION_ghc(9,6,1)
pattern PFailedWithErrorMessages :: forall a b. (b -> Bag (MsgEnvelope GhcMessage)) -> ParseResult a
#elif MIN_VERSION_ghc(9,3,0)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: make this the fallthrough case, we don't support GHC versions below 9.4 any more.

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.

3 participants