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

Another attempt at using the lsp API for some progress reporting #4218

Merged
merged 10 commits into from
May 19, 2024

Conversation

michaelpj
Copy link
Collaborator

No description provided.

@michaelpj
Copy link
Collaborator Author

Okay, I think the tests should pass now. I had to get rid of some of the functional tests because they test the real HLS executable, so that now includes a delay on starting progress. So we can't observe it unless we can make things take long enough, and we can't make the delay shorter because we're using the real HLS (unlike the ghcide tests which use a special executable with different options). I was able to arrange for one of the tests to have a long enough delay, so that might have to do for now.

As far as I can tell, this seems to work reliably. I would also like to rewrite the other special progress reporter, not sure if I'll do that in this PR or not.

@michaelpj
Copy link
Collaborator Author

Okay, many tests rely on waiting for progress notifications and are now somewhat broken. I shall continue on it.

@michaelpj
Copy link
Collaborator Author

This will fix #381, in that we won't show progress for fast operations, which will include most formatting operations.

It should also fix #3577, or at least mitigate it, in that updates will be throttled and won't be sent for short-lived "processing" operations.

@michaelpj
Copy link
Collaborator Author

Ready for a look, perhaps @soulomoon ?

Copy link
Collaborator

@soulomoon soulomoon left a comment

Choose a reason for hiding this comment

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

Looks good !
Just want to ask one thing, so we lose some of the notification tests since we now have 1 s delay for notification ? I wonder if we can set the shorter delay for testing and gain those test back?

test/functional/Progress.hs Show resolved Hide resolved
test/functional/Progress.hs Show resolved Hide resolved
@michaelpj
Copy link
Collaborator Author

Yes, so we have some special arguments for the ghcide executable that get used during testing that set the delay to 0. But for the HLS functional tests we don't call the main function of HLS we actually run the built executable, so I'm not sure how to make that nicely configurable...

@soulomoon
Copy link
Collaborator

soulomoon commented May 11, 2024

Yes, so we have some special arguments for the ghcide executable that get used during testing that set the delay to 0.

So it is using

hlsLspCommand :: String
hlsLspCommand = hlsExeCommand ++ " --lsp -d -j4"

Maybe we can generalize the special arguments for the ghcide to the hls-exe ?

@michaelpj
Copy link
Collaborator Author

Yeah, or maybe I can use an environment variable or something.

Copy link
Collaborator

@konn konn left a comment

Choose a reason for hiding this comment

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

LGTM as for Splice Plugin! 👍

@michaelpj michaelpj force-pushed the mpj/progress-reporting-experiments branch from 34766bb to 0e0a492 Compare May 19, 2024 13:43
@michaelpj michaelpj requested a review from wz1000 as a code owner May 19, 2024 13:43
@michaelpj
Copy link
Collaborator Author

We already had a --test argument to HLS that turns on the testing stuff, which I had already made change the delay. So I just needed to pass that in the test invocation and it works again.

@michaelpj michaelpj enabled auto-merge (squash) May 19, 2024 13:44
@michaelpj michaelpj disabled auto-merge May 19, 2024 15:06
@michaelpj michaelpj merged commit 0651c5c into master May 19, 2024
37 of 38 checks passed
{ LSP.optCompletionTriggerCharacters = Just "."
-- Generally people start to notice that something is taking a while at about 1s, so
-- that's when we start reporting progress
, LSP.optProgressStartDelay = 1_00_000
Copy link
Collaborator

@fendor fendor May 19, 2024

Choose a reason for hiding this comment

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

What a weird number. Shouldn't this be 1_000_000?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn 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.

None yet

4 participants