diff options
Diffstat (limited to 'crates/ra_hir/src/name.rs')
-rw-r--r-- | crates/ra_hir/src/name.rs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/crates/ra_hir/src/name.rs b/crates/ra_hir/src/name.rs index ba17958eb..0bb7cae99 100644 --- a/crates/ra_hir/src/name.rs +++ b/crates/ra_hir/src/name.rs | |||
@@ -98,13 +98,15 @@ pub(crate) trait AsName { | |||
98 | 98 | ||
99 | impl AsName for ast::NameRef { | 99 | impl AsName for ast::NameRef { |
100 | fn as_name(&self) -> Name { | 100 | fn as_name(&self) -> Name { |
101 | Name::new(self.text().clone()) | 101 | let name = resolve_name(self.text().clone()); |
102 | Name::new(name) | ||
102 | } | 103 | } |
103 | } | 104 | } |
104 | 105 | ||
105 | impl AsName for ast::Name { | 106 | impl AsName for ast::Name { |
106 | fn as_name(&self) -> Name { | 107 | fn as_name(&self) -> Name { |
107 | Name::new(self.text().clone()) | 108 | let name = resolve_name(self.text().clone()); |
109 | Name::new(name) | ||
108 | } | 110 | } |
109 | } | 111 | } |
110 | 112 | ||
@@ -184,3 +186,12 @@ impl AsName for KnownName { | |||
184 | Name::new(s.into()) | 186 | Name::new(s.into()) |
185 | } | 187 | } |
186 | } | 188 | } |
189 | |||
190 | fn resolve_name(text: SmolStr) -> SmolStr { | ||
191 | let raw_start = "r#"; | ||
192 | if text.as_str().starts_with(raw_start) { | ||
193 | SmolStr::new(&text[raw_start.len()..]) | ||
194 | } else { | ||
195 | text | ||
196 | } | ||
197 | } | ||