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 ++++++++++---------------- crates/ra_ide/src/goto_implementation.rs | 2 +- 2 files changed, 15 insertions(+), 23 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 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) { diff --git a/crates/ra_ide/src/goto_implementation.rs b/crates/ra_ide/src/goto_implementation.rs index 1882789c4..99a7022a4 100644 --- a/crates/ra_ide/src/goto_implementation.rs +++ b/crates/ra_ide/src/goto_implementation.rs @@ -76,7 +76,7 @@ fn impls_for_trait( mod tests { use ra_db::FileRange; - use crate::mock_analysis::{analysis_and_position, MockAnalysis}; + use crate::mock_analysis::MockAnalysis; fn check(ra_fixture: &str) { let (mock, position) = MockAnalysis::with_files_and_position(ra_fixture); -- cgit v1.2.3