diff options
Diffstat (limited to 'crates/ide/src/hover.rs')
-rw-r--r-- | crates/ide/src/hover.rs | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index 9cf02f0a3..4521d72cc 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs | |||
@@ -289,7 +289,7 @@ fn definition_owner_name(db: &RootDatabase, def: &Definition) -> Option<String> | |||
289 | 289 | ||
290 | fn render_path(db: &RootDatabase, module: Module, item_name: Option<String>) -> String { | 290 | fn render_path(db: &RootDatabase, module: Module, item_name: Option<String>) -> String { |
291 | let crate_name = | 291 | let crate_name = |
292 | db.crate_graph()[module.krate().into()].display_name.as_ref().map(ToString::to_string); | 292 | db.crate_graph()[module.krate().into()].declaration_name.as_ref().map(ToString::to_string); |
293 | let module_path = module | 293 | let module_path = module |
294 | .path_to_root(db) | 294 | .path_to_root(db) |
295 | .into_iter() | 295 | .into_iter() |
@@ -3163,4 +3163,34 @@ fn main() { let s<|>t = test().get(); } | |||
3163 | "#]], | 3163 | "#]], |
3164 | ); | 3164 | ); |
3165 | } | 3165 | } |
3166 | |||
3167 | #[test] | ||
3168 | fn hover_displays_normalized_crate_names() { | ||
3169 | check( | ||
3170 | r#" | ||
3171 | //- /lib.rs crate:name-with-dashes | ||
3172 | pub mod wrapper { | ||
3173 | pub struct Thing { x: u32 } | ||
3174 | |||
3175 | impl Thing { | ||
3176 | pub fn new() -> Thing { Thing { x: 0 } } | ||
3177 | } | ||
3178 | } | ||
3179 | |||
3180 | //- /main.rs crate:main deps:name-with-dashes | ||
3181 | fn main() { let foo_test = name_with_dashes::wrapper::Thing::new<|>(); } | ||
3182 | "#, | ||
3183 | expect![[r#" | ||
3184 | *new* | ||
3185 | |||
3186 | ```rust | ||
3187 | name_with_dashes::wrapper::Thing | ||
3188 | ``` | ||
3189 | |||
3190 | ```rust | ||
3191 | pub fn new() -> Thing | ||
3192 | ``` | ||
3193 | "#]], | ||
3194 | ) | ||
3195 | } | ||
3166 | } | 3196 | } |