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>
This commit is contained in:
bors[bot] 2020-05-05 10:02:56 +00:00 committed by GitHub
commit d1c1c01309
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 9 deletions

View file

@ -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,

View file

@ -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);
}
}
}

View file

@ -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.