diff options
author | Aleksey Kladov <[email protected]> | 2020-05-10 12:55:24 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-05-10 18:01:26 +0100 |
commit | 1586bab0b97bef411e6187dfc389557edbc5a16e (patch) | |
tree | f4d8b67d398ca663d003099be63da9ebb7652826 /crates/rust-analyzer/src/main_loop.rs | |
parent | 4578154b608fa075595103d0c933da60d55b25c8 (diff) |
Simplify proto conversion
Trait based infra in conv.rs is significantly more complicated than
what we actually need here.
Diffstat (limited to 'crates/rust-analyzer/src/main_loop.rs')
-rw-r--r-- | crates/rust-analyzer/src/main_loop.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index 17b0b95b9..e27d85dc9 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs | |||
@@ -37,8 +37,8 @@ use threadpool::ThreadPool; | |||
37 | 37 | ||
38 | use crate::{ | 38 | use crate::{ |
39 | config::{Config, FilesWatcher}, | 39 | config::{Config, FilesWatcher}, |
40 | conv::{ConvWith, TryConvWith}, | ||
41 | diagnostics::DiagnosticTask, | 40 | diagnostics::DiagnosticTask, |
41 | from_proto, | ||
42 | main_loop::{ | 42 | main_loop::{ |
43 | pending_requests::{PendingRequest, PendingRequests}, | 43 | pending_requests::{PendingRequest, PendingRequests}, |
44 | subscriptions::Subscriptions, | 44 | subscriptions::Subscriptions, |
@@ -584,7 +584,7 @@ fn on_notification( | |||
584 | Ok(params) => { | 584 | Ok(params) => { |
585 | let DidChangeTextDocumentParams { text_document, content_changes } = params; | 585 | let DidChangeTextDocumentParams { text_document, content_changes } = params; |
586 | let world = state.snapshot(); | 586 | let world = state.snapshot(); |
587 | let file_id = text_document.try_conv_with(&world)?; | 587 | let file_id = from_proto::file_id(&world, &text_document.uri)?; |
588 | let line_index = world.analysis().file_line_index(file_id)?; | 588 | let line_index = world.analysis().file_line_index(file_id)?; |
589 | let uri = text_document.uri; | 589 | let uri = text_document.uri; |
590 | let path = uri.to_file_path().map_err(|()| format!("invalid uri: {}", uri))?; | 590 | let path = uri.to_file_path().map_err(|()| format!("invalid uri: {}", uri))?; |
@@ -694,7 +694,7 @@ fn apply_document_changes( | |||
694 | line_index = Cow::Owned(LineIndex::new(&old_text)); | 694 | line_index = Cow::Owned(LineIndex::new(&old_text)); |
695 | } | 695 | } |
696 | index_valid = IndexValid::UpToLineExclusive(range.start.line); | 696 | index_valid = IndexValid::UpToLineExclusive(range.start.line); |
697 | let range = range.conv_with(&line_index); | 697 | let range = from_proto::text_range(&line_index, range); |
698 | let mut text = old_text.to_owned(); | 698 | let mut text = old_text.to_owned(); |
699 | match std::panic::catch_unwind(move || { | 699 | match std::panic::catch_unwind(move || { |
700 | text.replace_range(Range::<usize>::from(range), &change.text); | 700 | text.replace_range(Range::<usize>::from(range), &change.text); |