From 1586bab0b97bef411e6187dfc389557edbc5a16e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 10 May 2020 13:55:24 +0200 Subject: Simplify proto conversion Trait based infra in conv.rs is significantly more complicated than what we actually need here. --- crates/ra_ide/src/display/navigation_target.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'crates/ra_ide') diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs index de35c6711..5da28edd2 100644 --- a/crates/ra_ide/src/display/navigation_target.rs +++ b/crates/ra_ide/src/display/navigation_target.rs @@ -11,7 +11,7 @@ use ra_syntax::{ TextRange, }; -use crate::FileSymbol; +use crate::{FileRange, FileSymbol}; use super::short_label::ShortLabel; @@ -22,10 +22,11 @@ use super::short_label::ShortLabel; /// code, like a function or a struct, but this is not strictly required. #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct NavigationTarget { + // FIXME: use FileRange? file_id: FileId, + full_range: TextRange, name: SmolStr, kind: SyntaxKind, - full_range: TextRange, focus_range: Option, container_name: Option, description: Option, @@ -63,6 +64,10 @@ impl NavigationTarget { self.file_id } + pub fn file_range(&self) -> FileRange { + FileRange { file_id: self.file_id, range: self.full_range } + } + pub fn full_range(&self) -> TextRange { self.full_range } -- cgit v1.2.3