From 1ec1bd8139251092e567d0b6034f96e3fdf33afb Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 20 Jan 2019 20:59:46 +0300 Subject: make matching brace consistent --- crates/ra_lsp_server/src/main_loop/handlers.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'crates/ra_lsp_server') diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index 8f9db68a2..b70d67b4d 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs @@ -51,7 +51,6 @@ pub fn handle_find_matching_brace( params: req::FindMatchingBraceParams, ) -> Result> { let file_id = params.text_document.try_conv_with(&world)?; - let file = world.analysis().file_syntax(file_id); let line_index = world.analysis().file_line_index(file_id); let res = params .offsets @@ -60,7 +59,7 @@ pub fn handle_find_matching_brace( .map(|offset| { world .analysis() - .matching_brace(&file, offset) + .matching_brace(FilePosition { file_id, offset }) .unwrap_or(offset) }) .map_conv_with(&line_index) -- cgit v1.2.3 From 171f6e6d00d1fc99395b7b92c8a40b47d6bd6962 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 20 Jan 2019 21:01:11 +0300 Subject: somewhat better name --- crates/ra_lsp_server/src/main_loop/handlers.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ra_lsp_server') diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index b70d67b4d..5cd8abbb9 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs @@ -314,7 +314,7 @@ pub fn handle_completion( let mut res = false; if let Some(ctx) = params.context { if ctx.trigger_character.unwrap_or_default() == ":" { - let source_file = world.analysis().file_syntax(position.file_id); + let source_file = world.analysis().parse(position.file_id); let syntax = source_file.syntax(); let text = syntax.text(); if let Some(next_char) = text.char_at(position.offset) { -- cgit v1.2.3 From 73836cdbbc928f3512156f0bc0166e5a39ad9864 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 20 Jan 2019 21:05:01 +0300 Subject: extend selection expands macros and can totally panic --- crates/ra_lsp_server/src/main_loop/handlers.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'crates/ra_lsp_server') diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index 5cd8abbb9..02393f728 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs @@ -8,7 +8,7 @@ use lsp_types::{ WorkspaceEdit }; use ra_ide_api::{ - FileId, FilePosition, FileRange, FoldKind, Query, RangeInfo, RunnableKind, Severity, + FileId, FilePosition, FileRange, FoldKind, Query, RangeInfo, RunnableKind, Severity, Cancelable, }; use ra_syntax::{AstNode, TextUnit}; use rustc_hash::FxHashMap; @@ -40,9 +40,13 @@ pub fn handle_extend_selection( .into_iter() .map_conv_with(&line_index) .map(|range| FileRange { file_id, range }) - .map(|frange| world.analysis().extend_selection(frange)) - .map_conv_with(&line_index) - .collect(); + .map(|frange| { + world + .analysis() + .extend_selection(frange) + .map(|it| it.conv_with(&line_index)) + }) + .collect::>>()?; Ok(req::ExtendSelectionResult { selections }) } -- cgit v1.2.3