From a4b4fd7dc50575d015b404532ec9dd13e0a01835 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 2 Jan 2019 16:29:08 +0300 Subject: move symbols to ra_analysis --- crates/ra_analysis/src/imp.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/ra_analysis/src/imp.rs') diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index 5669aa94d..f3b513de1 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs @@ -10,7 +10,7 @@ use hir::{ self, FnSignatureInfo, Problem, source_binder, }; use ra_db::{FilesDatabase, SourceRoot, SourceRootId, SyntaxDatabase}; -use ra_editor::{self, FileSymbol, find_node_at_offset, LineIndex, LocalEdit, Severity}; +use ra_editor::{self, find_node_at_offset, LineIndex, LocalEdit, Severity}; use ra_syntax::{ algo::find_covering_node, ast::{self, ArgListOwner, Expr, FnDef, NameOwner}, @@ -25,7 +25,7 @@ use crate::{ completion::{CompletionItem, completions}, CrateId, db, Diagnostic, FileId, FilePosition, FileRange, FileSystemEdit, Query, ReferenceResolution, RootChange, SourceChange, SourceFileEdit, - symbol_index::{LibrarySymbolsQuery, SymbolIndex, SymbolsDatabase}, + symbol_index::{LibrarySymbolsQuery, SymbolIndex, SymbolsDatabase, FileSymbol}, }; #[derive(Debug, Default)] -- cgit v1.2.3 From d25c89f7608cb15e8c5ae08a92b6a7a6d6f308b8 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 2 Jan 2019 16:53:40 +0300 Subject: introduce navigation target --- crates/ra_analysis/src/imp.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'crates/ra_analysis/src/imp.rs') diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index f3b513de1..836fb89f5 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs @@ -21,7 +21,7 @@ use ra_syntax::{ use crate::{ AnalysisChange, - Cancelable, + Cancelable, NavigationTarget, completion::{CompletionItem, completions}, CrateId, db, Diagnostic, FileId, FilePosition, FileRange, FileSystemEdit, Query, ReferenceResolution, RootChange, SourceChange, SourceFileEdit, @@ -355,9 +355,9 @@ impl AnalysisImpl { Ok(Some((binding, descr))) } } - pub fn doc_text_for(&self, file_id: FileId, symbol: FileSymbol) -> Cancelable> { - let file = self.db.source_file(file_id); - let result = match (symbol.description(&file), symbol.docs(&file)) { + pub fn doc_text_for(&self, nav: NavigationTarget) -> Cancelable> { + let file = self.db.source_file(nav.file_id); + let result = match (nav.symbol.description(&file), nav.symbol.docs(&file)) { (Some(desc), Some(docs)) => { Some("```rust\n".to_string() + &*desc + "\n```\n\n" + &*docs) } -- cgit v1.2.3 From 830abe0c1b9fdbc20a78771d0b3df37d9eabdc3e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 2 Jan 2019 17:09:39 +0300 Subject: use navigation target in API --- crates/ra_analysis/src/imp.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/ra_analysis/src/imp.rs') diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index 836fb89f5..b513736bb 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs @@ -205,7 +205,7 @@ impl AnalysisImpl { /// This returns `Vec` because a module may be included from several places. We /// don't handle this case yet though, so the Vec has length at most one. - pub fn parent_module(&self, position: FilePosition) -> Cancelable> { + pub fn parent_module(&self, position: FilePosition) -> Cancelable> { let descr = match source_binder::module_from_position(&*self.db, position)? { None => return Ok(Vec::new()), Some(it) => it, @@ -216,12 +216,12 @@ impl AnalysisImpl { }; let decl = decl.borrowed(); let decl_name = decl.name().unwrap(); - let sym = FileSymbol { + let symbol = FileSymbol { name: decl_name.text(), node_range: decl_name.syntax().range(), kind: MODULE, }; - Ok(vec![(file_id, sym)]) + Ok(vec![NavigationTarget { file_id, symbol }]) } /// Returns `Vec` for the same reason as `parent_module` pub fn crate_for(&self, file_id: FileId) -> Cancelable> { -- cgit v1.2.3