mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
Fix crate display name dashes
This commit is contained in:
parent
6bc226fa19
commit
059ed25a3e
6 changed files with 40 additions and 20 deletions
|
@ -94,17 +94,22 @@ fn definition_owner_name(db: &RootDatabase, def: &Definition) -> Option<String>
|
|||
|
||||
fn determine_mod_path(db: &RootDatabase, def: &Definition) -> Option<String> {
|
||||
let mod_path = def.module(db).map(|module| {
|
||||
once(db.crate_graph()[module.krate().into()].display_name.clone())
|
||||
.chain(
|
||||
module
|
||||
.path_to_root(db)
|
||||
.into_iter()
|
||||
.rev()
|
||||
.map(|it| it.name(db).map(|name| name.to_string())),
|
||||
)
|
||||
.chain(once(definition_owner_name(db, def)))
|
||||
.flatten()
|
||||
.join("::")
|
||||
once(
|
||||
db.crate_graph()[module.krate().into()]
|
||||
.display_name
|
||||
.as_ref()
|
||||
.map(|name| name.get_name()),
|
||||
)
|
||||
.chain(
|
||||
module
|
||||
.path_to_root(db)
|
||||
.into_iter()
|
||||
.rev()
|
||||
.map(|it| it.name(db).map(|name| name.to_string())),
|
||||
)
|
||||
.chain(once(definition_owner_name(db, def)))
|
||||
.flatten()
|
||||
.join("::")
|
||||
});
|
||||
mod_path // FIXME: replace dashes with underscores in crate display name
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue