Merge branch 'main' into polish-project-diagnostics

This commit is contained in:
Max Brunsfeld 2022-01-05 20:38:20 -08:00
commit fee7657fd7
7 changed files with 87 additions and 60 deletions

View file

@ -712,7 +712,8 @@ impl Buffer {
let grammar_changed = this
.grammar()
.map_or(true, |curr_grammar| !Arc::ptr_eq(&grammar, curr_grammar));
let parse_again = this.version.gt(&parsed_version) || grammar_changed;
let parse_again =
this.version.changed_since(&parsed_version) || grammar_changed;
this.parsing_in_background = false;
this.did_finish_parsing(new_tree, parsed_version, cx);
@ -1080,12 +1081,12 @@ impl Buffer {
}
pub fn is_dirty(&self) -> bool {
!self.saved_version.ge(&self.version)
!self.saved_version.observed_all(&self.version)
|| self.file.as_ref().map_or(false, |file| file.is_deleted())
}
pub fn has_conflict(&self) -> bool {
!self.saved_version.ge(&self.version)
!self.saved_version.observed_all(&self.version)
&& self
.file
.as_ref()

View file

@ -919,6 +919,10 @@ fn test_random_collaboration(cx: &mut MutableAppContext, mut rng: StdRng) {
now += Duration::from_millis(rng.gen_range(0..=200));
buffers.extend(new_buffer);
for buffer in &buffers {
buffer.read(cx).check_invariants();
}
if mutation_count == 0 && network.is_idle() {
break;
}