aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/rust-analyzer/src/caps.rs6
-rw-r--r--crates/rust-analyzer/src/main_loop.rs10
2 files changed, 8 insertions, 8 deletions
diff --git a/crates/rust-analyzer/src/caps.rs b/crates/rust-analyzer/src/caps.rs
index 680415cac..110c9a442 100644
--- a/crates/rust-analyzer/src/caps.rs
+++ b/crates/rust-analyzer/src/caps.rs
@@ -17,10 +17,10 @@ pub fn server_capabilities() -> ServerCapabilities {
17 ServerCapabilities { 17 ServerCapabilities {
18 text_document_sync: Some(TextDocumentSyncCapability::Options(TextDocumentSyncOptions { 18 text_document_sync: Some(TextDocumentSyncCapability::Options(TextDocumentSyncOptions {
19 open_close: Some(true), 19 open_close: Some(true),
20 change: Some(if env::var("RA_PROFILE").is_ok() { 20 change: Some(if env::var("RA_NO_INCREMENTAL_SYNC").is_ok() {
21 TextDocumentSyncKind::Incremental
22 } else {
23 TextDocumentSyncKind::Full 21 TextDocumentSyncKind::Full
22 } else {
23 TextDocumentSyncKind::Incremental
24 }), 24 }),
25 will_save: None, 25 will_save: None,
26 will_save_wait_until: None, 26 will_save_wait_until: None,
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs
index 401fae755..b163ea848 100644
--- a/crates/rust-analyzer/src/main_loop.rs
+++ b/crates/rust-analyzer/src/main_loop.rs
@@ -676,13 +676,13 @@ fn apply_document_changes(
676 // remember the last valid line in the index and only rebuild it if needed. 676 // remember the last valid line in the index and only rebuild it if needed.
677 enum IndexValid { 677 enum IndexValid {
678 All, 678 All,
679 UpToLine(u64), 679 UpToLineExclusive(u64),
680 } 680 }
681 681
682 impl IndexValid { 682 impl IndexValid {
683 fn covers(&self, line: u64) -> bool { 683 fn covers(&self, line: u64) -> bool {
684 match *self { 684 match *self {
685 IndexValid::UpToLine(to) => to >= line, 685 IndexValid::UpToLineExclusive(to) => to > line,
686 _ => true, 686 _ => true,
687 } 687 }
688 } 688 }
@@ -692,10 +692,10 @@ fn apply_document_changes(
692 for change in content_changes { 692 for change in content_changes {
693 match change.range { 693 match change.range {
694 Some(range) => { 694 Some(range) => {
695 if !index_valid.covers(range.start.line) { 695 if !index_valid.covers(range.end.line) {
696 line_index = Cow::Owned(LineIndex::new(&old_text)); 696 line_index = Cow::Owned(LineIndex::new(&old_text));
697 } 697 }
698 index_valid = IndexValid::UpToLine(range.start.line); 698 index_valid = IndexValid::UpToLineExclusive(range.start.line);
699 let range = range.conv_with(&line_index); 699 let range = range.conv_with(&line_index);
700 let mut text = old_text.to_owned(); 700 let mut text = old_text.to_owned();
701 match std::panic::catch_unwind(move || { 701 match std::panic::catch_unwind(move || {
@@ -713,7 +713,7 @@ fn apply_document_changes(
713 } 713 }
714 None => { 714 None => {
715 *old_text = change.text; 715 *old_text = change.text;
716 index_valid = IndexValid::UpToLine(0); 716 index_valid = IndexValid::UpToLineExclusive(0);
717 } 717 }
718 } 718 }
719 } 719 }