diff options
Diffstat (limited to 'crates/ra_lsp_server/src/conv.rs')
-rw-r--r-- | crates/ra_lsp_server/src/conv.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/crates/ra_lsp_server/src/conv.rs b/crates/ra_lsp_server/src/conv.rs index 35c679a4a..0b9b18cbf 100644 --- a/crates/ra_lsp_server/src/conv.rs +++ b/crates/ra_lsp_server/src/conv.rs | |||
@@ -6,7 +6,7 @@ use languageserver_types::{ | |||
6 | }; | 6 | }; |
7 | use ra_ide_api::{ | 7 | use ra_ide_api::{ |
8 | CompletionItem, CompletionItemKind, FileId, FilePosition, FileRange, FileSystemEdit, | 8 | CompletionItem, CompletionItemKind, FileId, FilePosition, FileRange, FileSystemEdit, |
9 | InsertText, NavigationTarget, SourceChange, SourceFileEdit, | 9 | InsertText, NavigationTarget, SourceChange, SourceFileEdit, RangeInfo, |
10 | LineCol, LineIndex, translate_offset_with_edit | 10 | LineCol, LineIndex, translate_offset_with_edit |
11 | }; | 11 | }; |
12 | use ra_syntax::{SyntaxKind, TextRange, TextUnit}; | 12 | use ra_syntax::{SyntaxKind, TextRange, TextUnit}; |
@@ -349,6 +349,15 @@ impl TryConvWith for &NavigationTarget { | |||
349 | } | 349 | } |
350 | } | 350 | } |
351 | 351 | ||
352 | impl TryConvWith for &RangeInfo<NavigationTarget> { | ||
353 | type Ctx = ServerWorld; | ||
354 | type Output = Location; | ||
355 | fn try_conv_with(self, world: &ServerWorld) -> Result<Location> { | ||
356 | let line_index = world.analysis().file_line_index(self.info.file_id()); | ||
357 | to_location(self.info.file_id(), self.info.range(), &world, &line_index) | ||
358 | } | ||
359 | } | ||
360 | |||
352 | pub fn to_location( | 361 | pub fn to_location( |
353 | file_id: FileId, | 362 | file_id: FileId, |
354 | range: TextRange, | 363 | range: TextRange, |