aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/src/symbol_index.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_analysis/src/symbol_index.rs')
-rw-r--r--crates/ra_analysis/src/symbol_index.rs14
1 files changed, 5 insertions, 9 deletions
diff --git a/crates/ra_analysis/src/symbol_index.rs b/crates/ra_analysis/src/symbol_index.rs
index 65abaec2e..1b6815bbf 100644
--- a/crates/ra_analysis/src/symbol_index.rs
+++ b/crates/ra_analysis/src/symbol_index.rs
@@ -5,12 +5,12 @@ use std::{
5 5
6use fst::{self, Streamer}; 6use fst::{self, Streamer};
7use ra_syntax::{ 7use ra_syntax::{
8 SyntaxNodeRef, SourceFileNode, SmolStr, TextRange, 8 SyntaxNodeRef, SourceFileNode, SmolStr,
9 algo::visit::{visitor, Visitor}, 9 algo::visit::{visitor, Visitor},
10 SyntaxKind::{self, *}, 10 SyntaxKind::{self, *},
11 ast::{self, NameOwner}, 11 ast::{self, NameOwner},
12}; 12};
13use ra_db::{SyntaxDatabase, SourceRootId, FilesDatabase}; 13use ra_db::{SyntaxDatabase, SourceRootId, FilesDatabase, LocalSyntaxPtr};
14use salsa::ParallelDatabase; 14use salsa::ParallelDatabase;
15use rayon::prelude::*; 15use rayon::prelude::*;
16 16
@@ -140,7 +140,7 @@ impl Query {
140 let idx = indexed_value.value as usize; 140 let idx = indexed_value.value as usize;
141 141
142 let (file_id, symbol) = &file_symbols.symbols[idx]; 142 let (file_id, symbol) = &file_symbols.symbols[idx];
143 if self.only_types && !is_type(symbol.kind) { 143 if self.only_types && !is_type(symbol.ptr.kind()) {
144 continue; 144 continue;
145 } 145 }
146 if self.exact && symbol.name != self.query { 146 if self.exact && symbol.name != self.query {
@@ -163,9 +163,7 @@ fn is_type(kind: SyntaxKind) -> bool {
163#[derive(Debug, Clone, PartialEq, Eq, Hash)] 163#[derive(Debug, Clone, PartialEq, Eq, Hash)]
164pub(crate) struct FileSymbol { 164pub(crate) struct FileSymbol {
165 pub(crate) name: SmolStr, 165 pub(crate) name: SmolStr,
166 pub(crate) node_range: TextRange, 166 pub(crate) ptr: LocalSyntaxPtr,
167 pub(crate) kind: SyntaxKind,
168 _x: (),
169} 167}
170 168
171fn to_symbol(node: SyntaxNodeRef) -> Option<FileSymbol> { 169fn to_symbol(node: SyntaxNodeRef) -> Option<FileSymbol> {
@@ -173,9 +171,7 @@ fn to_symbol(node: SyntaxNodeRef) -> Option<FileSymbol> {
173 let name = node.name()?; 171 let name = node.name()?;
174 Some(FileSymbol { 172 Some(FileSymbol {
175 name: name.text(), 173 name: name.text(),
176 node_range: node.syntax().range(), 174 ptr: LocalSyntaxPtr::new(node.syntax()),
177 kind: node.syntax().kind(),
178 _x: (),
179 }) 175 })
180 } 176 }
181 visitor() 177 visitor()