Clear old diagnostics when restarting a language server

This commit is contained in:
Max Brunsfeld 2023-05-22 12:53:22 -07:00
parent e129ed2d91
commit 7689cdf3f9
5 changed files with 160 additions and 4 deletions

View file

@ -2565,6 +2565,23 @@ impl Project {
}
}
for buffer in self.opened_buffers.values() {
if let Some(buffer) = buffer.upgrade(cx) {
buffer.update(cx, |buffer, cx| {
buffer.update_diagnostics(server_id, Default::default(), cx);
});
}
}
for worktree in &self.worktrees {
if let Some(worktree) = worktree.upgrade(cx) {
worktree.update(cx, |worktree, cx| {
if let Some(worktree) = worktree.as_local_mut() {
worktree.clear_diagnostics_for_language_server(server_id, cx);
}
});
}
}
self.language_server_statuses.remove(&server_id);
cx.notify();