RUST Comments and doc highlight

Make a request or discuss new features.
Post Reply
ScrKiddle
Posts: 51
Joined: 05 Aug 2026 03:15

RUST Comments and doc highlight

Post by ScrKiddle »

In Rust there are some different types of comments.

Code: Select all

// Line Comment

Code: Select all

/*
   Comment Block
*/

Code: Select all

//! Code documentation

Code: Select all

/*!
    Code documentation Block
*/

Code: Select all

/// Code documentation

Code: Select all

#[doc = "Code documentation"]
https://doc.rust-lang.org/reference/com ... NT_CONTENT

Comments for documentation can contain simple markdown.
Comments can get nested.

Actually i see a difference between // line comments and /* block comments */, the attribute comments look like some code and all other comments look like line comments.

It would be nice if all the different types of comments can look some how different.
In example if the marker for documentation-comments could get a special color, and the comments which can contain markdown would use the markdown-highlighter but with some special background color the same may for attribute-comments.

// one color
/* ... */ an other color
//! an other color followed by markdown highlighter on special background color
/*! ... */ an other color followed by markdown highlighter on special background color
/// an other color followed by markdown highlighter on special background color
#[doc = "..."] an other color followed by markdown or rust highlighter on special background color

Some special case are code-blocks with backticks in markdown-comments, they also should use the correct highlighter (mostly for rust) but also use the same special background as the according comment-block.

this would be very fancy and outstanding, and its may not what people are used to (for now), but the possibility to activate such a granular highlighting would be amazing, may even the next level of highlighting for all future editors in general. :-D
ScrKiddle
Posts: 51
Joined: 05 Aug 2026 03:15

Re: RUST Comments and doc highlight

Post by ScrKiddle »

There is also an other thing, but same topic

RUST can use shebang

Code: Select all

#!/usr/bin/env rustx
Actually it looks a bit unusual like normal text, may there is a way to make it look more like other shebangs (some how comment-like).
Post Reply