From 351bba9bee136d856f987037b6ecffd0642d606f Mon Sep 17 00:00:00 2001 From: Paul Daniel Faria Date: Thu, 18 Jun 2020 09:37:22 -0400 Subject: Add support for marking doctest items as distinct from normal code, add default tag to all doctest elements --- crates/ra_ide/src/syntax_highlighting/injection.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'crates/ra_ide/src/syntax_highlighting/injection.rs') 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( let (analysis, tmp_file_id) = Analysis::from_single_file(text); stack.push(); - for mut h in analysis.with_db(|db| super::highlight(db, tmp_file_id, None, true)).unwrap() { + for mut h in analysis + .with_db(|db| super::highlight(db, tmp_file_id, None, true, Some(HighlightTag::Operator))) + .unwrap() + { // Determine start offset and end offset in case of multi-line ranges let mut start_offset = None; let mut end_offset = None; @@ -172,6 +175,7 @@ pub(super) fn highlight_doc_comment( h.range.end() + end_offset.unwrap_or(start_offset) - h.range.start(), ); + h.highlight |= HighlightModifier::Injected; stack.add(h); } } -- cgit v1.2.3