Clear old diagnostics when restarting a language server
This commit is contained in:
parent
e129ed2d91
commit
7689cdf3f9
5 changed files with 160 additions and 4 deletions
|
@ -1644,10 +1644,17 @@ impl Buffer {
|
|||
cx: &mut ModelContext<Self>,
|
||||
) {
|
||||
if lamport_timestamp > self.diagnostics_timestamp {
|
||||
match self.diagnostics.binary_search_by_key(&server_id, |e| e.0) {
|
||||
Err(ix) => self.diagnostics.insert(ix, (server_id, diagnostics)),
|
||||
Ok(ix) => self.diagnostics[ix].1 = diagnostics,
|
||||
};
|
||||
let ix = self.diagnostics.binary_search_by_key(&server_id, |e| e.0);
|
||||
if diagnostics.len() == 0 {
|
||||
if let Ok(ix) = ix {
|
||||
self.diagnostics.remove(ix);
|
||||
}
|
||||
} else {
|
||||
match ix {
|
||||
Err(ix) => self.diagnostics.insert(ix, (server_id, diagnostics)),
|
||||
Ok(ix) => self.diagnostics[ix].1 = diagnostics,
|
||||
};
|
||||
}
|
||||
self.diagnostics_timestamp = lamport_timestamp;
|
||||
self.diagnostics_update_count += 1;
|
||||
self.text.lamport_clock.observe(lamport_timestamp);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue