diff options
author | Paul Daniel Faria <[email protected]> | 2020-06-16 01:17:26 +0100 |
---|---|---|
committer | Paul Daniel Faria <[email protected]> | 2020-06-17 13:29:13 +0100 |
commit | aae26bc5b864971ef54f4d95d5ed89a6436334e2 (patch) | |
tree | 69d972ce3b4cf3f184ebb97a9c2846b858770400 /crates/ra_ide/src/syntax_highlighting.rs | |
parent | 931f3173992df6ac6b728fa9fa9a94d15781027e (diff) |
Add highlighting support for doc comments
Diffstat (limited to 'crates/ra_ide/src/syntax_highlighting.rs')
-rw-r--r-- | crates/ra_ide/src/syntax_highlighting.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index 5a4de450c..68dff45b7 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs | |||
@@ -475,7 +475,14 @@ fn highlight_element( | |||
475 | } | 475 | } |
476 | 476 | ||
477 | // Simple token-based highlighting | 477 | // Simple token-based highlighting |
478 | COMMENT => HighlightTag::Comment.into(), | 478 | COMMENT => { |
479 | let comment = element.into_token().and_then(ast::Comment::cast)?; | ||
480 | if comment.kind().doc.is_some() { | ||
481 | Highlight::from(HighlightTag::Comment) | HighlightModifier::Documentation | ||
482 | } else { | ||
483 | HighlightTag::Comment.into() | ||
484 | } | ||
485 | } | ||
479 | STRING | RAW_STRING | RAW_BYTE_STRING | BYTE_STRING => HighlightTag::StringLiteral.into(), | 486 | STRING | RAW_STRING | RAW_BYTE_STRING | BYTE_STRING => HighlightTag::StringLiteral.into(), |
480 | ATTR => HighlightTag::Attribute.into(), | 487 | ATTR => HighlightTag::Attribute.into(), |
481 | INT_NUMBER | FLOAT_NUMBER => HighlightTag::NumericLiteral.into(), | 488 | INT_NUMBER | FLOAT_NUMBER => HighlightTag::NumericLiteral.into(), |