Unnamed repository; edit this file 'description' to name the repository.
Allow searching with prefix
Jonathan Kelley 2024-05-23
parent 28ddddd · commit bdfcae5
-rw-r--r--crates/ide-db/src/symbol_index.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/crates/ide-db/src/symbol_index.rs b/crates/ide-db/src/symbol_index.rs
index e14cf0eb1f..5e1930e602 100644
--- a/crates/ide-db/src/symbol_index.rs
+++ b/crates/ide-db/src/symbol_index.rs
@@ -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) {
@@ -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),