mirror of
https://github.com/zed-industries/zed.git
synced 2024-09-19 02:17:35 +03:00
Revert "Don't replace newer diagnostics with older ones"
This reverts commit 71eeeedc05
.
This commit is contained in:
parent
e7e45be6e1
commit
4f39181c4c
@ -82,7 +82,6 @@ CREATE TABLE "worktree_diagnostic_summaries" (
|
||||
"language_server_id" INTEGER NOT NULL,
|
||||
"error_count" INTEGER NOT NULL,
|
||||
"warning_count" INTEGER NOT NULL,
|
||||
"version" INTEGER NOT NULL,
|
||||
PRIMARY KEY(project_id, worktree_id, path),
|
||||
FOREIGN KEY(project_id, worktree_id) REFERENCES worktrees (project_id, id) ON DELETE CASCADE
|
||||
);
|
||||
|
@ -44,7 +44,6 @@ CREATE TABLE "worktree_diagnostic_summaries" (
|
||||
"language_server_id" INTEGER NOT NULL,
|
||||
"error_count" INTEGER NOT NULL,
|
||||
"warning_count" INTEGER NOT NULL,
|
||||
"version" INTEGER NOT NULL,
|
||||
PRIMARY KEY(project_id, worktree_id, path),
|
||||
FOREIGN KEY(project_id, worktree_id) REFERENCES worktrees (project_id, id) ON DELETE CASCADE
|
||||
);
|
||||
|
@ -1809,15 +1809,13 @@ where
|
||||
path,
|
||||
language_server_id,
|
||||
error_count,
|
||||
warning_count,
|
||||
version
|
||||
warning_count
|
||||
)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7)
|
||||
VALUES ($1, $2, $3, $4, $5, $6)
|
||||
ON CONFLICT (project_id, worktree_id, path) DO UPDATE SET
|
||||
language_server_id = excluded.language_server_id,
|
||||
error_count = excluded.error_count,
|
||||
warning_count = excluded.warning_count,
|
||||
version = excluded.version
|
||||
warning_count = excluded.warning_count
|
||||
",
|
||||
)
|
||||
.bind(project_id)
|
||||
@ -1826,7 +1824,6 @@ where
|
||||
.bind(summary.language_server_id as i64)
|
||||
.bind(summary.error_count as i32)
|
||||
.bind(summary.warning_count as i32)
|
||||
.bind(summary.version as i32)
|
||||
.execute(&mut tx)
|
||||
.await?;
|
||||
|
||||
@ -2041,7 +2038,6 @@ where
|
||||
language_server_id: summary.language_server_id as u64,
|
||||
error_count: summary.error_count as u32,
|
||||
warning_count: summary.warning_count as u32,
|
||||
version: summary.version as u32,
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -2666,7 +2662,6 @@ struct WorktreeDiagnosticSummary {
|
||||
language_server_id: i64,
|
||||
error_count: i32,
|
||||
warning_count: i32,
|
||||
version: i32,
|
||||
}
|
||||
|
||||
id_type!(LanguageServerId);
|
||||
|
@ -2412,10 +2412,9 @@ async fn test_collaborating_with_diagnostics(
|
||||
path: Arc::from(Path::new("a.rs")),
|
||||
},
|
||||
DiagnosticSummary {
|
||||
language_server_id: 0,
|
||||
error_count: 1,
|
||||
warning_count: 0,
|
||||
version: 2,
|
||||
..Default::default()
|
||||
},
|
||||
)]
|
||||
)
|
||||
@ -2445,10 +2444,9 @@ async fn test_collaborating_with_diagnostics(
|
||||
path: Arc::from(Path::new("a.rs")),
|
||||
},
|
||||
DiagnosticSummary {
|
||||
language_server_id: 0,
|
||||
error_count: 1,
|
||||
warning_count: 0,
|
||||
version: 2,
|
||||
..Default::default()
|
||||
},
|
||||
)]
|
||||
);
|
||||
@ -2486,10 +2484,9 @@ async fn test_collaborating_with_diagnostics(
|
||||
path: Arc::from(Path::new("a.rs")),
|
||||
},
|
||||
DiagnosticSummary {
|
||||
language_server_id: 0,
|
||||
error_count: 1,
|
||||
warning_count: 1,
|
||||
version: 3,
|
||||
..Default::default()
|
||||
},
|
||||
)]
|
||||
);
|
||||
@ -2503,10 +2500,9 @@ async fn test_collaborating_with_diagnostics(
|
||||
path: Arc::from(Path::new("a.rs")),
|
||||
},
|
||||
DiagnosticSummary {
|
||||
language_server_id: 0,
|
||||
error_count: 1,
|
||||
warning_count: 1,
|
||||
version: 3,
|
||||
..Default::default()
|
||||
},
|
||||
)]
|
||||
);
|
||||
|
@ -223,7 +223,6 @@ pub struct DiagnosticSummary {
|
||||
pub language_server_id: usize,
|
||||
pub error_count: usize,
|
||||
pub warning_count: usize,
|
||||
pub version: usize,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
@ -294,14 +293,12 @@ pub struct ProjectTransaction(pub HashMap<ModelHandle<Buffer>, language::Transac
|
||||
impl DiagnosticSummary {
|
||||
fn new<'a, T: 'a>(
|
||||
language_server_id: usize,
|
||||
version: usize,
|
||||
diagnostics: impl IntoIterator<Item = &'a DiagnosticEntry<T>>,
|
||||
) -> Self {
|
||||
let mut this = Self {
|
||||
language_server_id,
|
||||
error_count: 0,
|
||||
warning_count: 0,
|
||||
version,
|
||||
};
|
||||
|
||||
for entry in diagnostics {
|
||||
@ -327,7 +324,6 @@ impl DiagnosticSummary {
|
||||
language_server_id: self.language_server_id as u64,
|
||||
error_count: self.error_count as u32,
|
||||
warning_count: self.warning_count as u32,
|
||||
version: self.version as u32,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -366,7 +366,6 @@ impl Worktree {
|
||||
Worktree::Remote(worktree) => &worktree.diagnostic_summaries,
|
||||
}
|
||||
.iter()
|
||||
.filter(|(_, summary)| !summary.is_empty())
|
||||
.map(|(path, summary)| (path.0.clone(), *summary))
|
||||
}
|
||||
|
||||
@ -517,8 +516,7 @@ impl LocalWorktree {
|
||||
.diagnostic_summaries
|
||||
.remove(&PathKey(worktree_path.clone()))
|
||||
.unwrap_or_default();
|
||||
let new_summary =
|
||||
DiagnosticSummary::new(language_server_id, old_summary.version + 1, &diagnostics);
|
||||
let new_summary = DiagnosticSummary::new(language_server_id, &diagnostics);
|
||||
if !new_summary.is_empty() {
|
||||
self.diagnostic_summaries
|
||||
.insert(PathKey(worktree_path.clone()), new_summary);
|
||||
@ -1108,17 +1106,15 @@ impl RemoteWorktree {
|
||||
path: Arc<Path>,
|
||||
summary: &proto::DiagnosticSummary,
|
||||
) {
|
||||
let old_summary = self.diagnostic_summaries.get(&PathKey(path.clone()));
|
||||
let new_summary = DiagnosticSummary {
|
||||
let summary = DiagnosticSummary {
|
||||
language_server_id: summary.language_server_id as usize,
|
||||
error_count: summary.error_count as usize,
|
||||
warning_count: summary.warning_count as usize,
|
||||
version: summary.version as usize,
|
||||
};
|
||||
if old_summary.map_or(true, |old_summary| {
|
||||
new_summary.version >= old_summary.version
|
||||
}) {
|
||||
self.diagnostic_summaries.insert(PathKey(path), new_summary);
|
||||
if summary.is_empty() {
|
||||
self.diagnostic_summaries.remove(&PathKey(path));
|
||||
} else {
|
||||
self.diagnostic_summaries.insert(PathKey(path), summary);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -652,7 +652,6 @@ message DiagnosticSummary {
|
||||
uint64 language_server_id = 2;
|
||||
uint32 error_count = 3;
|
||||
uint32 warning_count = 4;
|
||||
uint32 version = 5;
|
||||
}
|
||||
|
||||
message UpdateLanguageServer {
|
||||
|
Loading…
Reference in New Issue
Block a user