mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-24 02:46:43 +00:00
Merge pull request #1808 from zed-industries/fix-diagnostics-on-rust
Match progress token's prefix to detect disk-based diagnostic progress
This commit is contained in:
parent
50ba8bdc9b
commit
70cf542408
3 changed files with 10 additions and 5 deletions
|
@ -2262,8 +2262,11 @@ impl Project {
|
|||
return;
|
||||
}
|
||||
|
||||
let is_disk_based_diagnostics_progress =
|
||||
Some(token.as_ref()) == disk_based_diagnostics_progress_token.as_deref();
|
||||
let is_disk_based_diagnostics_progress = disk_based_diagnostics_progress_token
|
||||
.as_ref()
|
||||
.map_or(false, |disk_based_token| {
|
||||
token.starts_with(disk_based_token)
|
||||
});
|
||||
|
||||
match progress {
|
||||
lsp::WorkDoneProgress::Begin(report) => {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -93,7 +93,7 @@ impl LspAdapter for RustLspAdapter {
|
|||
}
|
||||
|
||||
async fn disk_based_diagnostics_progress_token(&self) -> Option<String> {
|
||||
Some("rustAnalyzer/cargo check".into())
|
||||
Some("rust-analyzer/checkOnSave".into())
|
||||
}
|
||||
|
||||
async fn process_diagnostics(&self, params: &mut lsp::PublishDiagnosticsParams) {
|
||||
|
|
Loading…
Reference in a new issue