aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/syntax_highlighting/injection.rs
diff options
context:
space:
mode:
authorPaul Daniel Faria <[email protected]>2020-06-17 14:33:21 +0100
committerPaul Daniel Faria <[email protected]>2020-06-17 14:33:21 +0100
commita951108173349f9ff0b9936ec2af8881fd92fc98 (patch)
treeebb7d11259f69534a167aff03abf579afaa3fe30 /crates/ra_ide/src/syntax_highlighting/injection.rs
parentaae26bc5b864971ef54f4d95d5ed89a6436334e2 (diff)
Ensure all existing doctest code highlights have documentation modifier
Diffstat (limited to 'crates/ra_ide/src/syntax_highlighting/injection.rs')
-rw-r--r--crates/ra_ide/src/syntax_highlighting/injection.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/crates/ra_ide/src/syntax_highlighting/injection.rs b/crates/ra_ide/src/syntax_highlighting/injection.rs
index 40436c5a2..dc12c8f5a 100644
--- a/crates/ra_ide/src/syntax_highlighting/injection.rs
+++ b/crates/ra_ide/src/syntax_highlighting/injection.rs
@@ -8,8 +8,8 @@ use ra_syntax::{ast, AstToken, SyntaxNode, SyntaxToken, TextRange, TextSize};
8use stdx::SepBy; 8use stdx::SepBy;
9 9
10use crate::{ 10use crate::{
11 call_info::ActiveParameter, Analysis, Highlight, HighlightModifier, HighlightTag, 11 call_info::ActiveParameter, Analysis, HighlightModifier, HighlightTag, HighlightedRange,
12 HighlightedRange, RootDatabase, 12 RootDatabase,
13}; 13};
14 14
15use super::HighlightedRangeStack; 15use super::HighlightedRangeStack;
@@ -121,8 +121,7 @@ pub(super) fn extract_doc_comments(
121 range.start(), 121 range.start(),
122 range.start() + TextSize::try_from(pos).unwrap(), 122 range.start() + TextSize::try_from(pos).unwrap(),
123 ), 123 ),
124 highlight: Highlight::from(HighlightTag::Comment) 124 highlight: HighlightTag::Comment | HighlightModifier::Documentation,
125 | HighlightModifier::Documentation,
126 binding_hash: None, 125 binding_hash: None,
127 }); 126 });
128 line_start += range.len() - TextSize::try_from(pos).unwrap(); 127 line_start += range.len() - TextSize::try_from(pos).unwrap();
@@ -168,6 +167,8 @@ pub(super) fn highlight_doc_comment(
168 h.range.start() + start_offset, 167 h.range.start() + start_offset,
169 h.range.end() + end_offset.unwrap_or(start_offset), 168 h.range.end() + end_offset.unwrap_or(start_offset),
170 ); 169 );
170
171 h.highlight |= HighlightModifier::Documentation;
171 stack.add(h); 172 stack.add(h);
172 } 173 }
173 } 174 }