Skip to content

Commit 2fa0b20

Browse files
committed
Remove debugging code for incremental sync
1 parent 5d7974e commit 2fa0b20

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

crates/rust-analyzer/src/main_loop.rs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -669,14 +669,11 @@ fn apply_document_changes(
669669
mut line_index: Cow<'_, LineIndex>,
670670
content_changes: Vec<TextDocumentContentChangeEvent>,
671671
) {
672-
// Remove when https://github.com/rust-analyzer/rust-analyzer/issues/4263 is fixed.
673-
let backup_text = old_text.clone();
674-
let backup_changes = content_changes.clone();
675-
676672
// The changes we got must be applied sequentially, but can cross lines so we
677673
// have to keep our line index updated.
678674
// Some clients (e.g. Code) sort the ranges in reverse. As an optimization, we
679675
// remember the last valid line in the index and only rebuild it if needed.
676+
// The VFS will normalize the end of lines to `\n`.
680677
enum IndexValid {
681678
All,
682679
UpToLineExclusive(u64),
@@ -700,19 +697,7 @@ fn apply_document_changes(
700697
}
701698
index_valid = IndexValid::UpToLineExclusive(range.start.line);
702699
let range = from_proto::text_range(&line_index, range);
703-
let mut text = old_text.to_owned();
704-
match std::panic::catch_unwind(move || {
705-
text.replace_range(Range::<usize>::from(range), &change.text);
706-
text
707-
}) {
708-
Ok(t) => *old_text = t,
709-
Err(e) => {
710-
eprintln!("Bug in incremental text synchronization. Please report the following output on https://github.com/rust-analyzer/rust-analyzer/issues/4263");
711-
dbg!(&backup_text);
712-
dbg!(&backup_changes);
713-
std::panic::resume_unwind(e);
714-
}
715-
}
700+
old_text.replace_range(Range::<usize>::from(range), &change.text);
716701
}
717702
None => {
718703
*old_text = change.text;

0 commit comments

Comments
 (0)