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

LSP general progress notification support #6055

Merged
merged 12 commits into from
Feb 6, 2024

Conversation

keirlawson
Copy link
Contributor

Initial PoC impl, manually tested against Helix. Feedback appreciated!

tickIfHidden()
value

if (clientConfig.statusBarState == StatusBarState.Off) {
Copy link
Contributor Author

@keirlawson keirlawson Jan 28, 2024

Choose a reason for hiding this comment

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

Strikes me that it might be a good idea to introduce an abstraction over StatusBar called Progress or similar which could have 2 impls, one for when statusbar support is detected, the other using the LSP progress stuff. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not the main contributor of metals but maybe we can also check if the client has window.workDoneProgress capability. If the client supports, metals can use progress instead of the existing status.

This will be similar to what gopls does.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Checking the capability makes sense, though as the status bar support is richer than native LSP progress notifications I wonder if the order of precedence should be status bar > LSP progress > no-op

Copy link
Contributor

Choose a reason for hiding this comment

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

Strikes me that it might be a good idea to introduce an abstraction over StatusBar called Progress or similar which could have 2 impls, one for when statusbar support is detected, the other using the LSP progress stuff. WDYT?

Since it's only this function I think it would be an overkill. Looks good as it is.

I wonder if the order of precedence should be status bar > LSP progress > no-op

Makes sense, I was hoping we could replace the custom status bar, but we even added some functionality there recently.

begin
)

client.createProgress(new WorkDoneProgressCreateParams(token))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This does return a CompletableFuture[Unit] which currently I'm throwing away. Not clear what this future represents and hence if it should be blocked on.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's probably to wait for creating the progress on the client I would guess.

@@ -102,6 +104,12 @@ trait MetalsLanguageClient
showMessage(params)
}

override def createProgress(
Copy link
Contributor

Choose a reason for hiding this comment

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

You might also need to add an empty method to NoopLanguageClient

Copy link
Contributor

@tgodzik tgodzik 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! Which clients currently don't support status? Maybe their maintainers could confirm that this works for them?

It works in Vs Code if I turn off status bar support.

begin
)

client.createProgress(new WorkDoneProgressCreateParams(token))
Copy link
Contributor

Choose a reason for hiding this comment

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

That's probably to wait for creating the progress on the client I would guess.

tickIfHidden()
value

if (clientConfig.statusBarState == StatusBarState.Off) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Strikes me that it might be a good idea to introduce an abstraction over StatusBar called Progress or similar which could have 2 impls, one for when statusbar support is detected, the other using the LSP progress stuff. WDYT?

Since it's only this function I think it would be an overkill. Looks good as it is.

I wonder if the order of precedence should be status bar > LSP progress > no-op

Makes sense, I was hoping we could replace the custom status bar, but we even added some functionality there recently.

@keirlawson keirlawson marked this pull request as ready for review February 5, 2024 19:19
@keirlawson
Copy link
Contributor Author

Looks good! Which clients currently don't support status? Maybe their maintainers could confirm that this works for them?

Don't have direct experience but eyeballing the integrations I believe Emacs, Vim and Sublime all support status, I think it was just Helix that didn't

@keirlawson keirlawson requested a review from tgodzik February 5, 2024 19:54
Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks!

@tgodzik tgodzik merged commit 76c95fb into scalameta:main Feb 6, 2024
26 checks passed
@keirlawson keirlawson deleted the progress-notification branch February 6, 2024 12:35
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