Allow canceling in-progress language server work (e.g. cargo check) (#13173)

Release Notes:

- Added a more detailed message in place of the generic `checking...`
messages when Rust-analyzer is running.
- Added a rate limit for language server status messages, to reduce
noisiness of those updates.
- Added a `cancel language server work` action which will cancel
long-running language server tasks.

---------

Co-authored-by: Richard <richard@zed.dev>
This commit is contained in:
Max Brunsfeld 2024-06-17 17:58:47 -07:00 committed by GitHub
parent f489c8b79f
commit 7003b0f211
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 308 additions and 164 deletions

View file

@ -1351,6 +1351,14 @@ impl FakeLanguageServer {
/// Simulate that the server has started work and notifies about its progress with the specified token.
pub async fn start_progress(&self, token: impl Into<String>) {
self.start_progress_with(token, Default::default()).await
}
pub async fn start_progress_with(
&self,
token: impl Into<String>,
progress: WorkDoneProgressBegin,
) {
let token = token.into();
self.request::<request::WorkDoneProgressCreate>(WorkDoneProgressCreateParams {
token: NumberOrString::String(token.clone()),
@ -1359,7 +1367,7 @@ impl FakeLanguageServer {
.unwrap();
self.notify::<notification::Progress>(ProgressParams {
token: NumberOrString::String(token),
value: ProgressParamsValue::WorkDone(WorkDoneProgress::Begin(Default::default())),
value: ProgressParamsValue::WorkDone(WorkDoneProgress::Begin(progress)),
});
}