Skip to content

Commit d1c1c01

Browse files
bors[bot]lnicolaCoder-256
authored
Merge #4306 #4308
4306: Make incremental sync opt-out and fix line index rebuild r=matklad a=lnicola 4308: Update server binary paths in docs r=matklad a=Coder-256 Fixed incorrect macOS path and converted to a list. Also, should the Windows path include `matklad.rust-analyzer`? (I can't check) Co-authored-by: Laurențiu Nicola <lnicola@dend.ro> Co-authored-by: Jacob Greenfield <jacob@jacobgreenfield.me>
3 parents a76d392 + 7c1d5f2 + bcc1717 commit d1c1c01

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

crates/rust-analyzer/src/caps.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ pub fn server_capabilities() -> ServerCapabilities {
1717
ServerCapabilities {
1818
text_document_sync: Some(TextDocumentSyncCapability::Options(TextDocumentSyncOptions {
1919
open_close: Some(true),
20-
change: Some(if env::var("RA_PROFILE").is_ok() {
21-
TextDocumentSyncKind::Incremental
22-
} else {
20+
change: Some(if env::var("RA_NO_INCREMENTAL_SYNC").is_ok() {
2321
TextDocumentSyncKind::Full
22+
} else {
23+
TextDocumentSyncKind::Incremental
2424
}),
2525
will_save: None,
2626
will_save_wait_until: None,

crates/rust-analyzer/src/main_loop.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -676,13 +676,13 @@ fn apply_document_changes(
676676
// remember the last valid line in the index and only rebuild it if needed.
677677
enum IndexValid {
678678
All,
679-
UpToLine(u64),
679+
UpToLineExclusive(u64),
680680
}
681681

682682
impl IndexValid {
683683
fn covers(&self, line: u64) -> bool {
684684
match *self {
685-
IndexValid::UpToLine(to) => to >= line,
685+
IndexValid::UpToLineExclusive(to) => to > line,
686686
_ => true,
687687
}
688688
}
@@ -692,10 +692,10 @@ fn apply_document_changes(
692692
for change in content_changes {
693693
match change.range {
694694
Some(range) => {
695-
if !index_valid.covers(range.start.line) {
695+
if !index_valid.covers(range.end.line) {
696696
line_index = Cow::Owned(LineIndex::new(&old_text));
697697
}
698-
index_valid = IndexValid::UpToLine(range.start.line);
698+
index_valid = IndexValid::UpToLineExclusive(range.start.line);
699699
let range = range.conv_with(&line_index);
700700
let mut text = old_text.to_owned();
701701
match std::panic::catch_unwind(move || {
@@ -713,7 +713,7 @@ fn apply_document_changes(
713713
}
714714
None => {
715715
*old_text = change.text;
716-
index_valid = IndexValid::UpToLine(0);
716+
index_valid = IndexValid::UpToLineExclusive(0);
717717
}
718718
}
719719
}

docs/user/readme.adoc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ To disable this notification put the following to `settings.json`
5757
----
5858
====
5959

60-
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).
60+
The server binary is stored in:
61+
62+
* Linux: `~/.config/Code/User/globalStorage/matklad.rust-analyzer`
63+
* macOS: `~/Library/Application Support/Code/User/globalStorage/matklad.rust-analyzer`
64+
* Windows: `%APPDATA%\Code\User\globalStorage`
6165

6266
Note that we only support the latest version of VS Code.
6367

0 commit comments

Comments
 (0)