-
Notifications
You must be signed in to change notification settings - Fork 354
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
Conversation
tickIfHidden() | ||
value | ||
|
||
if (clientConfig.statusBarState == StatusBarState.Off) { |
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.
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?
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'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.
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.
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
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.
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)) |
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.
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.
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.
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( |
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.
You might also need to add an empty method to NoopLanguageClient
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.
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)) |
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.
That's probably to wait for creating the progress on the client I would guess.
tickIfHidden() | ||
value | ||
|
||
if (clientConfig.statusBarState == StatusBarState.Off) { |
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.
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.
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 |
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.
LGTM! Thanks!
Initial PoC impl, manually tested against Helix. Feedback appreciated!