aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src
diff options
context:
space:
mode:
authorKirill Bulatov <[email protected]>2020-03-16 09:47:52 +0000
committerKirill Bulatov <[email protected]>2020-03-16 09:47:52 +0000
commit059ed25a3eea97f370c190803318d5cb7885e1a9 (patch)
tree7c4b36fc3623683380caf5bd6487e3f8aa57774a /crates/ra_ide/src
parent6bc226fa1918b8025b19cdf9d1f972f029e6a899 (diff)
Fix crate display name dashes
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r--crates/ra_ide/src/hover.rs27
-rw-r--r--crates/ra_ide/src/mock_analysis.rs2
2 files changed, 17 insertions, 12 deletions
diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs
index 3bdd61a2e..d1deca96b 100644
--- a/crates/ra_ide/src/hover.rs
+++ b/crates/ra_ide/src/hover.rs
@@ -94,17 +94,22 @@ fn definition_owner_name(db: &RootDatabase, def: &Definition) -> Option<String>
94 94
95fn determine_mod_path(db: &RootDatabase, def: &Definition) -> Option<String> { 95fn determine_mod_path(db: &RootDatabase, def: &Definition) -> Option<String> {
96 let mod_path = def.module(db).map(|module| { 96 let mod_path = def.module(db).map(|module| {
97 once(db.crate_graph()[module.krate().into()].display_name.clone()) 97 once(
98 .chain( 98 db.crate_graph()[module.krate().into()]
99 module 99 .display_name
100 .path_to_root(db) 100 .as_ref()
101 .into_iter() 101 .map(|name| name.get_name()),
102 .rev() 102 )
103 .map(|it| it.name(db).map(|name| name.to_string())), 103 .chain(
104 ) 104 module
105 .chain(once(definition_owner_name(db, def))) 105 .path_to_root(db)
106 .flatten() 106 .into_iter()
107 .join("::") 107 .rev()
108 .map(|it| it.name(db).map(|name| name.to_string())),
109 )
110 .chain(once(definition_owner_name(db, def)))
111 .flatten()
112 .join("::")
108 }); 113 });
109 mod_path // FIXME: replace dashes with underscores in crate display name 114 mod_path // FIXME: replace dashes with underscores in crate display name
110} 115}
diff --git a/crates/ra_ide/src/mock_analysis.rs b/crates/ra_ide/src/mock_analysis.rs
index 25816cf6f..2cf77a31f 100644
--- a/crates/ra_ide/src/mock_analysis.rs
+++ b/crates/ra_ide/src/mock_analysis.rs
@@ -109,7 +109,7 @@ impl MockAnalysis {
109 let other_crate = crate_graph.add_crate_root( 109 let other_crate = crate_graph.add_crate_root(
110 file_id, 110 file_id,
111 Edition2018, 111 Edition2018,
112 Some(crate_name.to_owned()), 112 Some(CrateName::new(crate_name).unwrap()),
113 cfg_options, 113 cfg_options,
114 Env::default(), 114 Env::default(),
115 Default::default(), 115 Default::default(),