Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide/src/navigation_target.rs')
-rw-r--r--crates/ide/src/navigation_target.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/crates/ide/src/navigation_target.rs b/crates/ide/src/navigation_target.rs
index fc836d5540..e40c7ecef0 100644
--- a/crates/ide/src/navigation_target.rs
+++ b/crates/ide/src/navigation_target.rs
@@ -926,4 +926,25 @@ struct Foo;
let navs = analysis.symbol_search(Query::new("foo".to_owned()), !0).unwrap();
assert_eq!(navs.len(), 2)
}
+
+ #[test]
+ fn test_ensure_hidden_symbols_are_not_returned() {
+ let (analysis, _) = fixture::file(
+ r#"
+fn foo() {}
+struct Foo;
+static __FOO_CALLSITE: () = ();
+"#,
+ );
+
+ // It doesn't show the hidden symbol
+ let navs = analysis.symbol_search(Query::new("foo".to_owned()), !0).unwrap();
+ assert_eq!(navs.len(), 2);
+
+ // Unless we configure a query to show hidden symbols
+ let mut query = Query::new("foo".to_owned());
+ query.include_hidden();
+ let navs = analysis.symbol_search(query, !0).unwrap();
+ assert_eq!(navs.len(), 3);
+ }
}