Skip to content

Commit

Permalink
Allow searching with prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
jkelleyrtp committed May 22, 2024
1 parent ada256c commit 69e9d75
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/tools/rust-analyzer/crates/ide-db/src/symbol_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ impl Query {
if non_type_for_type_only_query || !self.matches_assoc_mode(symbol.is_assoc) {
continue;
}
if !self.include_hidden && symbol.name.starts_with("__") {
if self.should_hide_query(&symbol) {
continue;
}
if self.mode.check(&self.query, self.case_sensitive, &symbol.name) {
Expand All @@ -392,6 +392,11 @@ impl Query {
}
}

fn should_hide_query(&self, symbol: &FileSymbol) -> bool {
// Hide symbols that start with `__` unless the query starts with `__`
!self.include_hidden && symbol.name.starts_with("__") && !self.query.starts_with("__")
}

fn matches_assoc_mode(&self, is_trait_assoc_item: bool) -> bool {
!matches!(
(is_trait_assoc_item, self.assoc_mode),
Expand Down

0 comments on commit 69e9d75

Please sign in to comment.