mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
return ref ranges from gotodef
This commit is contained in:
parent
f9ed8d4d23
commit
3aaf20bd6e
4 changed files with 24 additions and 10 deletions
|
@ -6,7 +6,7 @@ use languageserver_types::{
|
|||
};
|
||||
use ra_ide_api::{
|
||||
CompletionItem, CompletionItemKind, FileId, FilePosition, FileRange, FileSystemEdit,
|
||||
InsertText, NavigationTarget, SourceChange, SourceFileEdit,
|
||||
InsertText, NavigationTarget, SourceChange, SourceFileEdit, RangeInfo,
|
||||
LineCol, LineIndex, translate_offset_with_edit
|
||||
};
|
||||
use ra_syntax::{SyntaxKind, TextRange, TextUnit};
|
||||
|
@ -349,6 +349,15 @@ impl TryConvWith for &NavigationTarget {
|
|||
}
|
||||
}
|
||||
|
||||
impl TryConvWith for &RangeInfo<NavigationTarget> {
|
||||
type Ctx = ServerWorld;
|
||||
type Output = Location;
|
||||
fn try_conv_with(self, world: &ServerWorld) -> Result<Location> {
|
||||
let line_index = world.analysis().file_line_index(self.info.file_id());
|
||||
to_location(self.info.file_id(), self.info.range(), &world, &line_index)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_location(
|
||||
file_id: FileId,
|
||||
range: TextRange,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue