diff options
-rw-r--r-- | crates/base_db/src/fixture.rs | 4 | ||||
-rw-r--r-- | crates/ide/src/hover.rs | 30 |
2 files changed, 32 insertions, 2 deletions
diff --git a/crates/base_db/src/fixture.rs b/crates/base_db/src/fixture.rs index b7286fc7d..31560bc09 100644 --- a/crates/base_db/src/fixture.rs +++ b/crates/base_db/src/fixture.rs | |||
@@ -162,11 +162,11 @@ impl ChangeFixture { | |||
162 | meta.env, | 162 | meta.env, |
163 | Default::default(), | 163 | Default::default(), |
164 | ); | 164 | ); |
165 | let crate_name = CrateName::new(&krate).unwrap(); | 165 | let crate_name = CrateName::normalize_dashes(&krate); |
166 | let prev = crates.insert(crate_name.clone(), crate_id); | 166 | let prev = crates.insert(crate_name.clone(), crate_id); |
167 | assert!(prev.is_none()); | 167 | assert!(prev.is_none()); |
168 | for dep in meta.deps { | 168 | for dep in meta.deps { |
169 | let dep = CrateName::new(&dep).unwrap(); | 169 | let dep = CrateName::normalize_dashes(&dep); |
170 | crate_deps.push((crate_name.clone(), dep)) | 170 | crate_deps.push((crate_name.clone(), dep)) |
171 | } | 171 | } |
172 | } else if meta.path == "/main.rs" || meta.path == "/lib.rs" { | 172 | } else if meta.path == "/main.rs" || meta.path == "/lib.rs" { |
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index 9cf02f0a3..acdb51f26 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs | |||
@@ -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 | } |