mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
Fix #14557. Docs aliases can now be detected and used in searching for workspace symbols
This commit is contained in:
parent
a512774fd9
commit
1222869b3e
9 changed files with 337 additions and 47 deletions
|
@ -434,4 +434,31 @@ struct StructInModB;
|
|||
|
||||
expect_file!["./test_data/test_symbol_index_collection.txt"].assert_debug_eq(&symbols);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_doc_alias() {
|
||||
let (db, _) = RootDatabase::with_single_file(
|
||||
r#"
|
||||
#[doc(alias="s1")]
|
||||
#[doc(alias="s2")]
|
||||
#[doc(alias("mul1","mul2"))]
|
||||
struct Struct;
|
||||
|
||||
#[doc(alias="s1")]
|
||||
struct Duplicate;
|
||||
"#,
|
||||
);
|
||||
|
||||
let symbols: Vec<_> = Crate::from(db.test_crate())
|
||||
.modules(&db)
|
||||
.into_iter()
|
||||
.map(|module_id| {
|
||||
let mut symbols = SymbolCollector::collect_module(&db, module_id);
|
||||
symbols.sort_by_key(|it| it.name.clone());
|
||||
(module_id, symbols)
|
||||
})
|
||||
.collect();
|
||||
|
||||
expect_file!["./test_data/test_doc_alias.txt"].assert_debug_eq(&symbols);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue