From 191abf368563d6229c5e6025f7cde2e7d4c22ab0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Mon, 4 May 2020 19:54:23 +0300 Subject: Make incremental sync opt-out --- crates/rust-analyzer/src/caps.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 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 { ServerCapabilities { text_document_sync: Some(TextDocumentSyncCapability::Options(TextDocumentSyncOptions { open_close: Some(true), - change: Some(if env::var("RA_PROFILE").is_ok() { - TextDocumentSyncKind::Incremental - } else { + change: Some(if env::var("RA_NO_INCREMENTAL_SYNC").is_ok() { TextDocumentSyncKind::Full + } else { + TextDocumentSyncKind::Incremental }), will_save: None, will_save_wait_until: None, -- cgit v1.2.3 From 7c1d5f286a971484fc1f1d367e762853471873e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Mon, 4 May 2020 20:04:30 +0300 Subject: Fix line index rebuild during incremental changes --- crates/rust-analyzer/src/main_loop.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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( // remember the last valid line in the index and only rebuild it if needed. enum IndexValid { All, - UpToLine(u64), + UpToLineExclusive(u64), } impl IndexValid { fn covers(&self, line: u64) -> bool { match *self { - IndexValid::UpToLine(to) => to >= line, + IndexValid::UpToLineExclusive(to) => to > line, _ => true, } } @@ -692,10 +692,10 @@ fn apply_document_changes( for change in content_changes { match change.range { Some(range) => { - if !index_valid.covers(range.start.line) { + if !index_valid.covers(range.end.line) { line_index = Cow::Owned(LineIndex::new(&old_text)); } - index_valid = IndexValid::UpToLine(range.start.line); + index_valid = IndexValid::UpToLineExclusive(range.start.line); let range = range.conv_with(&line_index); let mut text = old_text.to_owned(); match std::panic::catch_unwind(move || { @@ -713,7 +713,7 @@ fn apply_document_changes( } None => { *old_text = change.text; - index_valid = IndexValid::UpToLine(0); + index_valid = IndexValid::UpToLineExclusive(0); } } } -- cgit v1.2.3 From bcc171737889038061ebf5714f71618f1a913bd3 Mon Sep 17 00:00:00 2001 From: Jacob Greenfield Date: Mon, 4 May 2020 13:16:29 -0400 Subject: Update server binary paths Fixed macOS path and converted to a list --- docs/user/readme.adoc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/user/readme.adoc b/docs/user/readme.adoc index b1af72ce6..29959ca72 100644 --- a/docs/user/readme.adoc +++ b/docs/user/readme.adoc @@ -57,7 +57,11 @@ To disable this notification put the following to `settings.json` ---- ==== -The server binary is stored in `~/.config/Code/User/globalStorage/matklad.rust-analyzer` (Linux) or in `~/.Library/Application Support/Code/User/globalStorage/matklad.rust-analyzer` (macOS) or in `%APPDATA%\Code\User\globalStorage` (Windows). +The server binary is stored in: + +* Linux: `~/.config/Code/User/globalStorage/matklad.rust-analyzer` +* macOS: `~/Library/Application Support/Code/User/globalStorage/matklad.rust-analyzer` +* Windows: `%APPDATA%\Code\User\globalStorage` Note that we only support the latest version of VS Code. -- cgit v1.2.3