aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_db/src/symbol_index.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_db/src/symbol_index.rs')
-rw-r--r--crates/ra_ide_db/src/symbol_index.rs24
1 files changed, 11 insertions, 13 deletions
diff --git a/crates/ra_ide_db/src/symbol_index.rs b/crates/ra_ide_db/src/symbol_index.rs
index 5a09e7d1d..35a2c5be3 100644
--- a/crates/ra_ide_db/src/symbol_index.rs
+++ b/crates/ra_ide_db/src/symbol_index.rs
@@ -87,7 +87,7 @@ impl Query {
87} 87}
88 88
89#[salsa::query_group(SymbolsDatabaseStorage)] 89#[salsa::query_group(SymbolsDatabaseStorage)]
90pub trait SymbolsDatabase: hir::db::HirDatabase + SourceDatabaseExt + ParallelDatabase { 90pub trait SymbolsDatabase: hir::db::HirDatabase + SourceDatabaseExt {
91 fn file_symbols(&self, file_id: FileId) -> Arc<SymbolIndex>; 91 fn file_symbols(&self, file_id: FileId) -> Arc<SymbolIndex>;
92 fn library_symbols(&self) -> Arc<FxHashMap<SourceRootId, SymbolIndex>>; 92 fn library_symbols(&self) -> Arc<FxHashMap<SourceRootId, SymbolIndex>>;
93 /// The set of "local" (that is, from the current workspace) roots. 93 /// The set of "local" (that is, from the current workspace) roots.
@@ -100,9 +100,7 @@ pub trait SymbolsDatabase: hir::db::HirDatabase + SourceDatabaseExt + ParallelDa
100 fn library_roots(&self) -> Arc<FxHashSet<SourceRootId>>; 100 fn library_roots(&self) -> Arc<FxHashSet<SourceRootId>>;
101} 101}
102 102
103fn library_symbols( 103fn library_symbols(db: &dyn SymbolsDatabase) -> Arc<FxHashMap<SourceRootId, SymbolIndex>> {
104 db: &(impl SymbolsDatabase + ParallelDatabase),
105) -> Arc<FxHashMap<SourceRootId, SymbolIndex>> {
106 let _p = profile("library_symbols"); 104 let _p = profile("library_symbols");
107 105
108 let roots = db.library_roots(); 106 let roots = db.library_roots();
@@ -123,7 +121,7 @@ fn library_symbols(
123 Arc::new(res) 121 Arc::new(res)
124} 122}
125 123
126fn file_symbols(db: &impl SymbolsDatabase, file_id: FileId) -> Arc<SymbolIndex> { 124fn file_symbols(db: &dyn SymbolsDatabase, file_id: FileId) -> Arc<SymbolIndex> {
127 db.check_canceled(); 125 db.check_canceled();
128 let parse = db.parse(file_id); 126 let parse = db.parse(file_id);
129 127
@@ -346,7 +344,7 @@ impl Query {
346} 344}
347 345
348fn is_type(kind: SyntaxKind) -> bool { 346fn is_type(kind: SyntaxKind) -> bool {
349 matches!(kind, STRUCT_DEF | ENUM_DEF | TRAIT_DEF | TYPE_ALIAS_DEF) 347 matches!(kind, STRUCT | ENUM | TRAIT | TYPE_ALIAS)
350} 348}
351 349
352/// The actual data that is stored in the index. It should be as compact as 350/// The actual data that is stored in the index. It should be as compact as
@@ -399,14 +397,14 @@ fn to_symbol(node: &SyntaxNode) -> Option<(SmolStr, SyntaxNodePtr, TextRange)> {
399 } 397 }
400 match_ast! { 398 match_ast! {
401 match node { 399 match node {
402 ast::FnDef(it) => decl(it), 400 ast::Fn(it) => decl(it),
403 ast::StructDef(it) => decl(it), 401 ast::Struct(it) => decl(it),
404 ast::EnumDef(it) => decl(it), 402 ast::Enum(it) => decl(it),
405 ast::TraitDef(it) => decl(it), 403 ast::Trait(it) => decl(it),
406 ast::Module(it) => decl(it), 404 ast::Module(it) => decl(it),
407 ast::TypeAliasDef(it) => decl(it), 405 ast::TypeAlias(it) => decl(it),
408 ast::ConstDef(it) => decl(it), 406 ast::Const(it) => decl(it),
409 ast::StaticDef(it) => decl(it), 407 ast::Static(it) => decl(it),
410 ast::MacroCall(it) => { 408 ast::MacroCall(it) => {
411 if it.is_macro_rules().is_some() { 409 if it.is_macro_rules().is_some() {
412 decl(it) 410 decl(it)