mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
Add highlighting support for doc comments
This commit is contained in:
parent
931f317399
commit
aae26bc5b8
5 changed files with 56 additions and 41 deletions
|
@ -475,7 +475,14 @@ fn highlight_element(
|
|||
}
|
||||
|
||||
// Simple token-based highlighting
|
||||
COMMENT => HighlightTag::Comment.into(),
|
||||
COMMENT => {
|
||||
let comment = element.into_token().and_then(ast::Comment::cast)?;
|
||||
if comment.kind().doc.is_some() {
|
||||
Highlight::from(HighlightTag::Comment) | HighlightModifier::Documentation
|
||||
} else {
|
||||
HighlightTag::Comment.into()
|
||||
}
|
||||
}
|
||||
STRING | RAW_STRING | RAW_BYTE_STRING | BYTE_STRING => HighlightTag::StringLiteral.into(),
|
||||
ATTR => HighlightTag::Attribute.into(),
|
||||
INT_NUMBER | FLOAT_NUMBER => HighlightTag::NumericLiteral.into(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue