diff options
author | Laurențiu Nicola <[email protected]> | 2020-06-16 19:28:57 +0100 |
---|---|---|
committer | Laurențiu Nicola <[email protected]> | 2020-06-16 20:06:24 +0100 |
commit | 2fa0b20ce05a1d6b8f9bf0f0d9f1dfb15b84fb9d (patch) | |
tree | c9cc17ecfa88e0fe1fc05bca7052f3e524787605 | |
parent | 5d7974e5fb921236fea74731d8edde518f08e73a (diff) |
Remove debugging code for incremental sync
-rw-r--r-- | crates/rust-analyzer/src/main_loop.rs | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index cc9bb1726..887253d5b 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs | |||
@@ -669,14 +669,11 @@ fn apply_document_changes( | |||
669 | mut line_index: Cow<'_, LineIndex>, | 669 | mut line_index: Cow<'_, LineIndex>, |
670 | content_changes: Vec<TextDocumentContentChangeEvent>, | 670 | content_changes: Vec<TextDocumentContentChangeEvent>, |
671 | ) { | 671 | ) { |
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 | |||
676 | // The changes we got must be applied sequentially, but can cross lines so we | 672 | // The changes we got must be applied sequentially, but can cross lines so we |
677 | // have to keep our line index updated. | 673 | // have to keep our line index updated. |
678 | // Some clients (e.g. Code) sort the ranges in reverse. As an optimization, we | 674 | // Some clients (e.g. Code) sort the ranges in reverse. As an optimization, we |
679 | // remember the last valid line in the index and only rebuild it if needed. | 675 | // 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`. | ||
680 | enum IndexValid { | 677 | enum IndexValid { |
681 | All, | 678 | All, |
682 | UpToLineExclusive(u64), | 679 | UpToLineExclusive(u64), |
@@ -700,19 +697,7 @@ fn apply_document_changes( | |||
700 | } | 697 | } |
701 | index_valid = IndexValid::UpToLineExclusive(range.start.line); | 698 | index_valid = IndexValid::UpToLineExclusive(range.start.line); |
702 | let range = from_proto::text_range(&line_index, range); | 699 | let range = from_proto::text_range(&line_index, range); |
703 | let mut text = old_text.to_owned(); | 700 | old_text.replace_range(Range::<usize>::from(range), &change.text); |
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 | } | ||
716 | } | 701 | } |
717 | None => { | 702 | None => { |
718 | *old_text = change.text; | 703 | *old_text = change.text; |