diff options
Diffstat (limited to 'crates/ide/src/syntax_highlighting')
-rw-r--r-- | crates/ide/src/syntax_highlighting/inject.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/crates/ide/src/syntax_highlighting/inject.rs b/crates/ide/src/syntax_highlighting/inject.rs index 0f1de4fb8..d4c367f66 100644 --- a/crates/ide/src/syntax_highlighting/inject.rs +++ b/crates/ide/src/syntax_highlighting/inject.rs | |||
@@ -153,6 +153,7 @@ pub(super) fn doc_comment(hl: &mut Highlights, sema: &Semantics<RootDatabase>, n | |||
153 | if attributes.docs().map_or(true, |docs| !String::from(docs).contains(RUSTDOC_FENCE)) { | 153 | if attributes.docs().map_or(true, |docs| !String::from(docs).contains(RUSTDOC_FENCE)) { |
154 | return; | 154 | return; |
155 | } | 155 | } |
156 | let attrs_source_map = attributes.source_map(&owner); | ||
156 | 157 | ||
157 | let mut inj = Injector::default(); | 158 | let mut inj = Injector::default(); |
158 | inj.add_unmapped("fn doctest() {\n"); | 159 | inj.add_unmapped("fn doctest() {\n"); |
@@ -165,7 +166,7 @@ pub(super) fn doc_comment(hl: &mut Highlights, sema: &Semantics<RootDatabase>, n | |||
165 | let mut new_comments = Vec::new(); | 166 | let mut new_comments = Vec::new(); |
166 | let mut string; | 167 | let mut string; |
167 | for attr in attributes.by_key("doc").attrs() { | 168 | for attr in attributes.by_key("doc").attrs() { |
168 | let src = attr.to_src(&owner); | 169 | let src = attrs_source_map.source_of(&attr); |
169 | let (line, range, prefix) = match &src { | 170 | let (line, range, prefix) = match &src { |
170 | Either::Left(it) => { | 171 | Either::Left(it) => { |
171 | string = match find_doc_string_in_attr(attr, it) { | 172 | string = match find_doc_string_in_attr(attr, it) { |