diff options
author | Paul Daniel Faria <[email protected]> | 2020-06-18 14:37:22 +0100 |
---|---|---|
committer | Paul Daniel Faria <[email protected]> | 2020-06-23 17:08:04 +0100 |
commit | 351bba9bee136d856f987037b6ecffd0642d606f (patch) | |
tree | 50ef4af147ef3f539086aec02e274655552ee6ef /crates/ra_ide/src/syntax_highlighting/injection.rs | |
parent | 0c12c4f9609ee72487af9b55a558b01af73ffe3e (diff) |
Add support for marking doctest items as distinct from normal code, add default tag to all doctest elements
Diffstat (limited to 'crates/ra_ide/src/syntax_highlighting/injection.rs')
-rw-r--r-- | crates/ra_ide/src/syntax_highlighting/injection.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/crates/ra_ide/src/syntax_highlighting/injection.rs b/crates/ra_ide/src/syntax_highlighting/injection.rs index 9d82b4009..bd38cdb6f 100644 --- a/crates/ra_ide/src/syntax_highlighting/injection.rs +++ b/crates/ra_ide/src/syntax_highlighting/injection.rs | |||
@@ -150,7 +150,10 @@ pub(super) fn highlight_doc_comment( | |||
150 | let (analysis, tmp_file_id) = Analysis::from_single_file(text); | 150 | let (analysis, tmp_file_id) = Analysis::from_single_file(text); |
151 | 151 | ||
152 | stack.push(); | 152 | stack.push(); |
153 | for mut h in analysis.with_db(|db| super::highlight(db, tmp_file_id, None, true)).unwrap() { | 153 | for mut h in analysis |
154 | .with_db(|db| super::highlight(db, tmp_file_id, None, true, Some(HighlightTag::Operator))) | ||
155 | .unwrap() | ||
156 | { | ||
154 | // Determine start offset and end offset in case of multi-line ranges | 157 | // Determine start offset and end offset in case of multi-line ranges |
155 | let mut start_offset = None; | 158 | let mut start_offset = None; |
156 | let mut end_offset = None; | 159 | let mut end_offset = None; |
@@ -172,6 +175,7 @@ pub(super) fn highlight_doc_comment( | |||
172 | h.range.end() + end_offset.unwrap_or(start_offset) - h.range.start(), | 175 | h.range.end() + end_offset.unwrap_or(start_offset) - h.range.start(), |
173 | ); | 176 | ); |
174 | 177 | ||
178 | h.highlight |= HighlightModifier::Injected; | ||
175 | stack.add(h); | 179 | stack.add(h); |
176 | } | 180 | } |
177 | } | 181 | } |