mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 17:28:09 +00:00
Return inner attributes of outline mod declarations in attrs_query
This commit is contained in:
parent
286d90de2d
commit
999e020da2
2 changed files with 25 additions and 1 deletions
|
@ -200,7 +200,15 @@ impl Attrs {
|
|||
let mod_data = &def_map[module.local_id];
|
||||
match mod_data.declaration_source(db) {
|
||||
Some(it) => {
|
||||
RawAttrs::from_attrs_owner(db, it.as_ref().map(|it| it as &dyn AttrsOwner))
|
||||
let raw_attrs = RawAttrs::from_attrs_owner(
|
||||
db,
|
||||
it.as_ref().map(|it| it as &dyn AttrsOwner),
|
||||
);
|
||||
match mod_data.definition_source(db) {
|
||||
InFile { file_id, value: ModuleSource::SourceFile(file) } => raw_attrs
|
||||
.merge(RawAttrs::from_attrs_owner(db, InFile::new(file_id, &file))),
|
||||
_ => raw_attrs,
|
||||
}
|
||||
}
|
||||
None => RawAttrs::from_attrs_owner(
|
||||
db,
|
||||
|
|
|
@ -3444,4 +3444,20 @@ impl<const LEN: usize> Foo<LEN$0> {}
|
|||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hover_mod_def() {
|
||||
check(
|
||||
r#"
|
||||
//- /main.rs
|
||||
mod foo$0;
|
||||
//- /foo.rs
|
||||
//! For the horde!
|
||||
"#,
|
||||
expect![[r#"
|
||||
*foo*
|
||||
For the horde!
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue