From af7e300041b1af68e671446fe22d2b9e5d30f83d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 30 Jun 2020 13:27:13 +0200 Subject: Remove confusing API --- crates/ra_ide/src/display/navigation_target.rs | 36 ++++++++++---------------- 1 file changed, 14 insertions(+), 22 deletions(-) (limited to 'crates/ra_ide/src/display') diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs index f8a466304..8bf2428ed 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::{FileRange, FileSymbol}; +use crate::FileSymbol; use super::short_label::ShortLabel; @@ -47,6 +47,19 @@ impl NavigationTarget { pub fn range(&self) -> TextRange { self.focus_range.unwrap_or(self.full_range) } + /// A "most interesting" range withing the `full_range`. + /// + /// Typically, `full_range` is the whole syntax node, + /// including doc comments, and `focus_range` is the range of the identifier. + pub fn focus_range(&self) -> Option { + self.focus_range + } + pub fn full_range(&self) -> TextRange { + self.full_range + } + pub fn file_id(&self) -> FileId { + self.file_id + } pub fn name(&self) -> &SmolStr { &self.name @@ -60,19 +73,6 @@ impl NavigationTarget { self.kind } - pub fn file_id(&self) -> FileId { - self.file_id - } - - // TODO: inconsistent - 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 - } - pub fn docs(&self) -> Option<&str> { self.docs.as_deref() } @@ -81,14 +81,6 @@ impl NavigationTarget { self.description.as_deref() } - /// A "most interesting" range withing the `full_range`. - /// - /// Typically, `full_range` is the whole syntax node, - /// including doc comments, and `focus_range` is the range of the identifier. - pub fn focus_range(&self) -> Option { - self.focus_range - } - pub(crate) fn from_module_to_decl(db: &RootDatabase, module: hir::Module) -> NavigationTarget { let name = module.name(db).map(|it| it.to_string().into()).unwrap_or_default(); if let Some(src) = module.declaration_source(db) { -- cgit v1.2.3