mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
fix: Fix process-changes duplicating change events
This commit is contained in:
parent
f38264fa56
commit
cace5bb35d
1 changed files with 9 additions and 10 deletions
|
@ -196,7 +196,7 @@ impl GlobalState {
|
||||||
let (change, changed_files) = {
|
let (change, changed_files) = {
|
||||||
let mut change = Change::new();
|
let mut change = Change::new();
|
||||||
let (vfs, line_endings_map) = &mut *self.vfs.write();
|
let (vfs, line_endings_map) = &mut *self.vfs.write();
|
||||||
let mut changed_files = vfs.take_changes();
|
let changed_files = vfs.take_changes();
|
||||||
if changed_files.is_empty() {
|
if changed_files.is_empty() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -204,7 +204,7 @@ impl GlobalState {
|
||||||
// We need to fix up the changed events a bit. If we have a create or modify for a file
|
// We need to fix up the changed events a bit. If we have a create or modify for a file
|
||||||
// id that is followed by a delete we actually skip observing the file text from the
|
// id that is followed by a delete we actually skip observing the file text from the
|
||||||
// earlier event, to avoid problems later on.
|
// earlier event, to avoid problems later on.
|
||||||
for changed_file in &changed_files {
|
for changed_file in changed_files {
|
||||||
use vfs::ChangeKind::*;
|
use vfs::ChangeKind::*;
|
||||||
|
|
||||||
file_changes
|
file_changes
|
||||||
|
@ -240,14 +240,13 @@ impl GlobalState {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
changed_files.extend(
|
let changed_files: Vec<_> = file_changes
|
||||||
file_changes
|
.into_iter()
|
||||||
.into_iter()
|
.filter(|(_, (change_kind, just_created))| {
|
||||||
.filter(|(_, (change_kind, just_created))| {
|
!matches!((change_kind, just_created), (vfs::ChangeKind::Delete, true))
|
||||||
!matches!((change_kind, just_created), (vfs::ChangeKind::Delete, true))
|
})
|
||||||
})
|
.map(|(file_id, (change_kind, _))| vfs::ChangedFile { file_id, change_kind })
|
||||||
.map(|(file_id, (change_kind, _))| vfs::ChangedFile { file_id, change_kind }),
|
.collect();
|
||||||
);
|
|
||||||
|
|
||||||
// A file was added or deleted
|
// A file was added or deleted
|
||||||
let mut has_structure_changes = false;
|
let mut has_structure_changes = false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue