aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/symbol_index.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-03-17 09:59:04 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-03-17 09:59:04 +0000
commit7d3f48cdaf20d718e711f999573adf3303e9396a (patch)
treedf584fbb044cad23e196da5ae0b3636b06bfeeff /crates/ra_ide_api/src/symbol_index.rs
parent65e763fa84ae70ec9cee13f434acaae5371ad8e5 (diff)
parent3a770233652cbf3e48688dd5f1d9f3c363eda5a8 (diff)
Merge #968
968: Macro aware name resoltion r=matklad a=matklad The first commit lays the ground work for new name resolution, including * extracting position-indendent items from parse trees * walking the tree of modules * old-style macro_rules resolve cc @pnkfelix: this looks like an API name resolution should interact with. Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide_api/src/symbol_index.rs')
-rw-r--r--crates/ra_ide_api/src/symbol_index.rs11
1 files changed, 3 insertions, 8 deletions
diff --git a/crates/ra_ide_api/src/symbol_index.rs b/crates/ra_ide_api/src/symbol_index.rs
index 94fe1d6d7..23c743bef 100644
--- a/crates/ra_ide_api/src/symbol_index.rs
+++ b/crates/ra_ide_api/src/symbol_index.rs
@@ -30,7 +30,7 @@ use std::{
30use fst::{self, Streamer}; 30use fst::{self, Streamer};
31use ra_syntax::{ 31use ra_syntax::{
32 SyntaxNode, SyntaxNodePtr, SourceFile, SmolStr, TreeArc, AstNode, 32 SyntaxNode, SyntaxNodePtr, SourceFile, SmolStr, TreeArc, AstNode,
33 algo::{visit::{visitor, Visitor}, find_covering_node}, 33 algo::{visit::{visitor, Visitor}},
34 SyntaxKind::{self, *}, 34 SyntaxKind::{self, *},
35 ast::{self, NameOwner}, 35 ast::{self, NameOwner},
36 WalkEvent, 36 WalkEvent,
@@ -66,14 +66,9 @@ fn file_symbols(db: &impl SymbolsDatabase, file_id: FileId) -> Arc<SymbolIndex>
66 db.check_canceled(); 66 db.check_canceled();
67 let source_file = db.parse(file_id); 67 let source_file = db.parse(file_id);
68 68
69 let mut symbols = source_file_to_file_symbols(&source_file, file_id); 69 let symbols = source_file_to_file_symbols(&source_file, file_id);
70 70
71 for (name, text_range) in hir::source_binder::macro_symbols(db, file_id) { 71 // TODO: add macros here
72 let node = find_covering_node(source_file.syntax(), text_range);
73 let ptr = SyntaxNodePtr::new(node);
74 // TODO: Should we get container name for macro symbols?
75 symbols.push(FileSymbol { file_id, name, ptr, name_range: None, container_name: None })
76 }
77 72
78 Arc::new(SymbolIndex::new(symbols)) 73 Arc::new(SymbolIndex::new(symbols))
79} 74}