Remove aggressive logging from WrapMap update code paths

This commit is contained in:
Antonio Scandurra 2021-11-18 11:13:40 +01:00
parent 08e0444ee4
commit 856768a43c
2 changed files with 1 additions and 96 deletions

View file

@ -346,7 +346,7 @@ impl DisplayMapSnapshot {
}
pub fn longest_row(&self) -> u32 {
self.wraps_snapshot.longest_row()
self.blocks_snapshot.longest_row()
}
}

View file

@ -299,14 +299,6 @@ impl Snapshot {
}
fn interpolate(&mut self, new_tab_snapshot: TabSnapshot, tab_edits: &[TabEdit]) -> Patch {
log::info!("INTERPOLATING");
log::info!("updating transforms... old transforms are:");
for transform in self.transforms.items(&()) {
log::info!(" - i {:?}", transform.summary.input);
log::info!(" o {:?}", transform.summary.output);
}
let mut new_transforms;
if tab_edits.is_empty() {
new_transforms = self.transforms.clone();
@ -320,26 +312,12 @@ impl Snapshot {
&(),
);
log::info!("sliced, new_transforms are:");
for transform in new_transforms.items(&()) {
log::info!(" - i {:?}", transform.summary.input);
log::info!(" o {:?}", transform.summary.output);
}
while let Some(edit) = tab_edits_iter.next() {
log::info!("processing edit {:?}", edit);
if edit.new_lines.start > TabPoint::from(new_transforms.summary().input.lines) {
let summary = new_tab_snapshot.text_summary_for_range(
TabPoint::from(new_transforms.summary().input.lines)..edit.new_lines.start,
);
log::info!("pushing prefix before edit: {:?}", summary);
new_transforms.push_or_extend(Transform::isomorphic(summary));
log::info!("new transforms are now:");
for transform in new_transforms.items(&()) {
log::info!(" - i {:?}", transform.summary.input);
log::info!(" o {:?}", transform.summary.output);
}
}
if !edit.new_lines.is_empty() {
@ -348,12 +326,6 @@ impl Snapshot {
));
}
log::info!("pushed summary within edit new range; new transforms now:");
for transform in new_transforms.items(&()) {
log::info!(" - i {:?}", transform.summary.input);
log::info!(" o {:?}", transform.summary.output);
}
old_cursor.seek_forward(&edit.old_lines.end, Bias::Right, &());
if let Some(next_edit) = tab_edits_iter.peek() {
if next_edit.old_lines.start > old_cursor.end(&()) {
@ -364,45 +336,21 @@ impl Snapshot {
new_transforms.push_or_extend(Transform::isomorphic(summary));
}
log::info!("pushed transform suffix after edit; new transforms now:");
for transform in new_transforms.items(&()) {
log::info!(" - i {:?}", transform.summary.input);
log::info!(" o {:?}", transform.summary.output);
}
old_cursor.next(&());
new_transforms.push_tree(
old_cursor.slice(&next_edit.old_lines.start, Bias::Right, &()),
&(),
);
log::info!("pushed tree suffix after edit; new transforms now:");
for transform in new_transforms.items(&()) {
log::info!(" - i {:?}", transform.summary.input);
log::info!(" o {:?}", transform.summary.output);
}
}
} else {
log::info!("no more edits");
if old_cursor.end(&()) > edit.old_lines.end {
let summary = self
.tab_snapshot
.text_summary_for_range(edit.old_lines.end..old_cursor.end(&()));
new_transforms.push_or_extend(Transform::isomorphic(summary));
log::info!("pushed transform suffix after edit; new transforms now:");
for transform in new_transforms.items(&()) {
log::info!(" - i {:?}", transform.summary.input);
log::info!(" o {:?}", transform.summary.output);
}
}
old_cursor.next(&());
new_transforms.push_tree(old_cursor.suffix(&()), &());
log::info!("pushed suffix:");
for transform in new_transforms.items(&()) {
log::info!(" - i {:?}", transform.summary.input);
log::info!(" o {:?}", transform.summary.output);
}
}
}
}
@ -432,12 +380,6 @@ impl Snapshot {
new_rows: Range<u32>,
}
log::info!("updating transforms... old transforms are:");
for transform in self.transforms.items(&()) {
log::info!(" - i {:?}", transform.summary.input);
log::info!(" o {:?}", transform.summary.output);
}
let mut tab_edits_iter = tab_edits.into_iter().peekable();
let mut row_edits = Vec::new();
while let Some(edit) = tab_edits_iter.next() {
@ -459,11 +401,6 @@ impl Snapshot {
row_edits.push(row_edit);
}
log::info!("row edits are:");
for edit in &row_edits {
log::info!(" {:?}", edit);
}
let mut new_transforms;
if row_edits.is_empty() {
new_transforms = self.transforms.clone();
@ -477,12 +414,6 @@ impl Snapshot {
&(),
);
log::info!("sliced a prefix:");
for transform in new_transforms.items(&()) {
log::info!(" - i {:?}", transform.summary.input);
log::info!(" o {:?}", transform.summary.output);
}
while let Some(edit) = row_edits.next() {
if edit.new_rows.start > new_transforms.summary().input.lines.row {
let summary = new_tab_snapshot.text_summary_for_range(
@ -536,15 +467,9 @@ impl Snapshot {
}
let mut edit_transforms = edit_transforms.into_iter();
log::info!("extending tree with edit transforms");
if let Some(transform) = edit_transforms.next() {
log::info!(
"push or extend with first transform: {:?}",
transform.summary.output
);
new_transforms.push_or_extend(transform);
}
log::info!("extending with remaining transforms");
new_transforms.extend(edit_transforms, &());
old_cursor.seek_forward(&TabPoint::new(edit.old_rows.end, 0), Bias::Right, &());
@ -943,17 +868,10 @@ impl sum_tree::Item for Transform {
}
fn push_isomorphic(transforms: &mut Vec<Transform>, summary: TextSummary) {
log::info!("push_isomorphic: {:?}", summary);
if let Some(last_transform) = transforms.last_mut() {
if last_transform.is_isomorphic() {
last_transform.summary.input += &summary;
last_transform.summary.output += &summary;
log::info!(
" extended previous isomorphic: {:?}",
last_transform.summary.output
);
return;
}
}
@ -970,28 +888,15 @@ impl SumTreeExt for SumTree<Transform> {
self.update_last(
|last_transform| {
if last_transform.is_isomorphic() && transform.as_ref().unwrap().is_isomorphic() {
// log::info!("extending last transform in tree");
// log::info!(
// " extending with: {:?}",
// transform.as_ref().map(|t| t.summary.output.clone()),
// );
// log::info!(" last transform was: {:?}", last_transform.summary.output);
let transform = transform.take().unwrap();
last_transform.summary.input += &transform.summary.input;
last_transform.summary.output += &transform.summary.output;
// log::info!(
// " last transform is now {:?}",
// last_transform.summary.output,
// )
}
},
&(),
);
if let Some(transform) = transform {
log::info!("!!!!!!!!!!! push transform: {:?}", transform.summary.output,);
self.push(transform, &());
}
}