diff --git a/crates/rust-analyzer/src/caps.rs b/crates/rust-analyzer/src/caps.rs index 680415caca2..110c9a44297 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, diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index 401fae75565..b163ea848f7 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 covers(&self, line: u64) -> bool { 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 covers(&self, line: u64) -> bool { } None => { *old_text = change.text; - index_valid = IndexValid::UpToLine(0); + index_valid = IndexValid::UpToLineExclusive(0); } } } diff --git a/docs/user/readme.adoc b/docs/user/readme.adoc index 2c0a96a059d..69f5b13d6b8 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.