mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 15:15:24 +00:00
fix: Clear native diagnostics for files when they are deleted
This commit is contained in:
parent
f02c915eb5
commit
5410ace1fe
2 changed files with 9 additions and 0 deletions
|
@ -40,6 +40,11 @@ impl DiagnosticCollection {
|
|||
self.changes.extend(self.check.drain().map(|(key, _value)| key))
|
||||
}
|
||||
|
||||
pub(crate) fn clear_native_for(&mut self, file_id: FileId) {
|
||||
self.native.remove(&file_id);
|
||||
self.changes.insert(file_id);
|
||||
}
|
||||
|
||||
pub(crate) fn add_check_diagnostic(
|
||||
&mut self,
|
||||
file_id: FileId,
|
||||
|
|
|
@ -201,6 +201,10 @@ impl GlobalState {
|
|||
}
|
||||
}
|
||||
|
||||
if !file.exists() {
|
||||
self.diagnostics.clear_native_for(file.file_id);
|
||||
}
|
||||
|
||||
let text = if file.exists() {
|
||||
let bytes = vfs.file_contents(file.file_id).to_vec();
|
||||
String::from_utf8(bytes).ok().and_then(|text| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue