Match progress token's prefix to detect disk-based diagnostic progress

The new version of rust-analyzer changed the disk-based diagnostic token
to `rust-analyzer/checkOnSave/0`. The trailing number could be different
from 0 when there are multiple Rust projects open using the same rust-analyzer
instance.

As such, with this commit we will perform a prefix match as opposed to a strict
equality check when detecting a disk-based diagnostics progress token.
This commit is contained in:
Antonio Scandurra 2022-10-25 11:35:59 +02:00
parent af74d5409a
commit 19adfdf8bb
3 changed files with 10 additions and 5 deletions

View file

@ -644,7 +644,9 @@ async fn test_disk_based_diagnostics_progress(cx: &mut gpui::TestAppContext) {
let mut events = subscribe(&project, cx);
let fake_server = fake_servers.next().await.unwrap();
fake_server.start_progress(progress_token).await;
fake_server
.start_progress(format!("{}/0", progress_token))
.await;
assert_eq!(
events.next().await.unwrap(),
Event::DiskBasedDiagnosticsStarted {
@ -670,7 +672,7 @@ async fn test_disk_based_diagnostics_progress(cx: &mut gpui::TestAppContext) {
}
);
fake_server.end_progress(progress_token);
fake_server.end_progress(format!("{}/0", progress_token));
assert_eq!(
events.next().await.unwrap(),
Event::DiskBasedDiagnosticsFinished {