diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_ide_api/src/extend_selection.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide_api/src/lib.rs | 4 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/main_loop/handlers.rs | 12 |
3 files changed, 11 insertions, 7 deletions
diff --git a/crates/ra_ide_api/src/extend_selection.rs b/crates/ra_ide_api/src/extend_selection.rs index 9f0ab2f1c..718b4def5 100644 --- a/crates/ra_ide_api/src/extend_selection.rs +++ b/crates/ra_ide_api/src/extend_selection.rs | |||
@@ -51,7 +51,7 @@ mod tests { | |||
51 | } | 51 | } |
52 | ", | 52 | ", |
53 | ); | 53 | ); |
54 | let r = analysis.extend_selection(frange); | 54 | let r = analysis.extend_selection(frange).unwrap(); |
55 | assert_eq!(r, TextRange::from_to(51.into(), 56.into())); | 55 | assert_eq!(r, TextRange::from_to(51.into(), 56.into())); |
56 | } | 56 | } |
57 | } | 57 | } |
diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs index e41d85e70..919d248e2 100644 --- a/crates/ra_ide_api/src/lib.rs +++ b/crates/ra_ide_api/src/lib.rs | |||
@@ -310,8 +310,8 @@ impl Analysis { | |||
310 | } | 310 | } |
311 | 311 | ||
312 | /// Selects the next syntactic nodes encopasing the range. | 312 | /// Selects the next syntactic nodes encopasing the range. |
313 | pub fn extend_selection(&self, frange: FileRange) -> TextRange { | 313 | pub fn extend_selection(&self, frange: FileRange) -> Cancelable<TextRange> { |
314 | extend_selection::extend_selection(&self.db, frange) | 314 | self.with_db(|db| extend_selection::extend_selection(db, frange)) |
315 | } | 315 | } |
316 | 316 | ||
317 | /// Returns position of the mathcing brace (all types of braces are | 317 | /// Returns position of the mathcing brace (all types of braces are |
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::{ | |||
8 | WorkspaceEdit | 8 | WorkspaceEdit |
9 | }; | 9 | }; |
10 | use ra_ide_api::{ | 10 | use ra_ide_api::{ |
11 | FileId, FilePosition, FileRange, FoldKind, Query, RangeInfo, RunnableKind, Severity, | 11 | FileId, FilePosition, FileRange, FoldKind, Query, RangeInfo, RunnableKind, Severity, Cancelable, |
12 | }; | 12 | }; |
13 | use ra_syntax::{AstNode, TextUnit}; | 13 | use ra_syntax::{AstNode, TextUnit}; |
14 | use rustc_hash::FxHashMap; | 14 | use rustc_hash::FxHashMap; |
@@ -40,9 +40,13 @@ pub fn handle_extend_selection( | |||
40 | .into_iter() | 40 | .into_iter() |
41 | .map_conv_with(&line_index) | 41 | .map_conv_with(&line_index) |
42 | .map(|range| FileRange { file_id, range }) | 42 | .map(|range| FileRange { file_id, range }) |
43 | .map(|frange| world.analysis().extend_selection(frange)) | 43 | .map(|frange| { |
44 | .map_conv_with(&line_index) | 44 | world |
45 | .collect(); | 45 | .analysis() |
46 | .extend_selection(frange) | ||
47 | .map(|it| it.conv_with(&line_index)) | ||
48 | }) | ||
49 | .collect::<Cancelable<Vec<_>>>()?; | ||
46 | Ok(req::ExtendSelectionResult { selections }) | 50 | Ok(req::ExtendSelectionResult { selections }) |
47 | } | 51 | } |
48 | 52 | ||