Skip to content

Repository files navigation

Color.Comment

Visual Studio extension: Color C++ Comments.

Status

BranchBuild Status
2022Build status
2019Build status
2017Build status

Description

Extension adds options to overwrite colors of certain C++ Comments.
Extension works in files of ContentType"C/C++", eg.cpp or .h files.

Usage

New entries will appear in ToolsOptionsEnvironmentFonts and ColorsText Editor.
Each will begin with either C++ Comments: xor C++ Documentation: prefix.

  • Edit their color values, until you want to keep extension default ones (listed below).
  • If you don't want to change some attribute's color at all, set it's Item foreground value to Automatic.

Preview

Default Comments without extensionColor Comments with extension enabled

Options

New entries will appear in ToolsOptionsColor.Comment. Each corresponds to different feature.
Options allows to disable, enable xor conditionally enable related features (coloring blocks of comments).

States

Full list of option states:

EnumStateMeaning
NoNoDisable feature (don't overwrite color of it's occurencies)
AllYes, in all commentsEnable feature (overwrite color of it's occurencies)
TripleYes, but in triple slash comments onlyAs above, but only in triple slash comments (that begins with ///)

Details

Full list of options (Default state: Triple: Yes, but in triple slash comments only):

OptionDetails
Color parameter referencesPrefixed by $
Color template parameter referencesPrefixed by ^
Color member referencesPrefixed by .
Color static referencesPrefixed by !
Color local referencesPrefixed by @
Color macro referencesPrefixed by %
Color line–wide quotesPrefixed by >
Color line–wide codePrefixed by //
Color inline codeSurrounded by U+0060 ​`​ GRAVE ACCENT symbol

Note

Note that editing options does not take immediate effect to keep performance.
It requires reclassification, eg triggered by editing corresponding part of code.

Customization

Extension exposes several entries for customization across two kinds of comments to customize:

  • C++ Comment prefixed ones refers to Regular comments (all but triple slash comments, eg//, //// or /////).
  • C++ Documentation prefixed ones refers to Documentation comments (triple slash comments (that begins with ///).

Multiline comments are not supported. They will be untouched by this extensions, so shall remain default coloring.

Quotes

Quotes are line–wide blocks of comments which value begins with >.

Option

Option that enables quotes is C++ Comment: Quote.

Example

/// > Talk is cheap. Show me the code./// ~ Linus Torvalds
  • Talk is cheap. Show me the code. is a quote and will be colored as C++ Comment: Quote.
  • > is a quote mark and will be colored as C++ Comment: Quote: ">".

Code

Codes are line–wide blocks of comments which value begins with //.

Option

Option that enables quotes is Color line–wide code.

Example

/// Close connection./// Example usage:/// // Connection.Close();voidClose();
  • Connection.Close(); is a code and will be colored as C++ Comment: Code.
  • // is a code mark and will be colored as C++ Comment: Code: "//".

Inline Code

Inline Codes are blocks of comments surrounded by Grave Accent (U+0060 ​`​) symbol.

Option

Option that enables quotes is Color inline code.

Example

/// Begin a new session./// \note On a debug mode, .Ping `10.0.0.2` upon session creation.voidBegin();
  • 10.0.0.2 is an inline code and will be colored as C++ Comment: Inline Code.
  • Both ​`​ are an inline code marks and will be colored as C++ Comment: Inline Code: "`".

References

References are inline mentions of entities (functions, variables etc.) in comments.
References consist of a single punctuation character immediatelly followed by an identifier.
For example: $Left references parameter Left; ^Floating references template parameter Floating.

Options

Options that enables references are:

  • Color parameter references
  • Color template parameter references
  • Color member references
  • Color static references
  • Color local references
  • Color macro references

Example

/// Cache with absolute value of .Resultunsignedint Cache_AbsResult = 0;
  • .Result is a reference to Result member. Result will be colored as C++ Comment: Reference: Member.
  • . is a member reference mark and will be colored as C++ Comment: Reference: Member: ".".

Details

Full list of references:

ReferencePrefix
Parameter$
Template Parameter^
Member.
Static!
Local@
Macro%

Headers

Headers are line–wide documentation commands for tools like Doxygen or Standardese.
Headers are enabled for triple slash C++ Documentation comments only (that begins with ///).
Headers begins with either @ or \, immediatelly followed by an identifier.

Details

  • Headers format of Parameters and Template Parameters:
    [\\@] Identifier [ \t\v\f]* Identifier?...?[ \t\v\f]*([:=])?.*, ie\param Right Exponent value.
  • Header format for all the rest:
    [\\@] Identifier [ \t\v\f]*([:=])?.*, ie\short Description..

Examples

/// \short Description./// @details : More info./// \param Right Exponent value./// @tparam Floating = Type convertible to `float`.

Details

Full List of supported Headers:

HeaderCommand
Effecteffects?|briefs?|shorts?|details?
Notenotes?|attentions?|warn(ing)?s?|pre|post|requires?
Todoto(do|fix)?|plans?|fixme
Seesee(also)?|related?s?
Bugbugs?|errors?|issues?
Returnreturns?|results?|retvals?
Sparespares?|defaults?|backups?
Throwexcept(ion)?s?|throws?

Details

Full list of customizable Comment entries, with their default colors:

Comment entryTypeColorRGB (0 – 255)
C++ CommentCommentGray128, 128, 128
C++ Comment: "//"Comment PunctDark Gray​ 80, ​ 80, ​ 80
C++ Comment: Reference: Parameter: "$"Comment PunctDark Gray​ 80, ​ 80, ​ 80
C++ Comment: Reference: ParameterParamCyan176, 224, 224
C++ Comment: Reference: Template Parameter: "^"Comment PunctDark Gray​ 80, ​ 80, ​ 80
C++ Comment: Reference: Template ParameterTParamGreen176, 224, 128
C++ Comment: Reference: Member: "."Comment PunctDark Gray​ 80, ​ 80, ​ 80
C++ Comment: Reference: MemberMemberYellow224, 224, 128
C++ Comment: Reference: Static: "!"Comment PunctDark Gray​ 80, ​ 80, ​ 80
C++ Comment: Reference: StaticStaticRed224, 128, 128
C++ Comment: Reference: Local: "@"Comment PunctDark Gray​ 80, ​ 80, ​ 80
C++ Comment: Reference: LocalLocalWhite224, 224, 224
C++ Comment: Reference: Macro: "%"Comment PunctDark Gray​ 80, ​ 80, ​ 80
C++ Comment: Reference: MacroMacroPurple176, 128, 224
C++ Comment: Quote: ">"Dark StringDark Red176, ​ 80, ​ 80
C++ Comment: QuoteStringRed224, 128, 128
C++ Comment: Code: "//"Comment PunctDark Gray​ 80, ​ 80, ​ 80
C++ Comment: CodeCommentGray128, 128, 128
C++ Comment: Inline Code: "`"Comment PunctDark Gray​ 80, ​ 80, ​ 80
C++ Comment: Inline CodeCommentGray128, 128, 128
C++ DocumentationPlainDark White176, 176, 176
C++ Documentation: "///"Comment PunctDark Gray​ 80, ​ 80, ​ 80
C++ Documentation: PunctuationComment PunctDark Gray​ 80, ​ 80, ​ 80
C++ Documentation: Punctuation: "@" | "\"Comment PunctDark Gray​ 80, ​ 80, ​ 80
C++ Documentation: EffectEffectBlue128, 176, 224
C++ Documentation: Effect: DescriptionPlainDark White176, 176, 176
C++ Documentation: NoteNoteYellow224, 224, 128
C++ Documentation: Note: DescriptionPlainDark White176, 176, 176
C++ Documentation: TodoTodoPink224, 128, 224
C++ Documentation: Todo: DescriptionPlainDark White176, 176, 176
C++ Documentation: SeeEffectGreen176, 224, 128
C++ Documentation: See: DescriptionPlainDark White176, 176, 176
C++ Documentation: BugEffectDark Red224, ​ 96, ​ 96
C++ Documentation: Bug: DescriptionPlainDark White176, 176, 176
C++ Documentation: ReturnReturnViolet128, 128, 224
C++ Documentation: Return: DescriptionPlainDark White176, 176, 176
C++ Documentation: SpareSpareLime176, 224, 128
C++ Documentation: Spare: DescriptionPlainDark White176, 176, 176
C++ Documentation: ThrowThrowRed224, 128, 128
C++ Documentation: Throw: DescriptionPlainDark White176, 176, 176
C++ Documentation: ParameterCommentGray128, 128, 128
C++ Documentation: Parameter: NameParamCyan176, 224, 224
C++ Documentation: Parameter: DescriptionPlainDark White176, 176, 176
C++ Documentation: Template ParameterCommentGray128, 128, 128
C++ Documentation: Template Parameter: NameTParamGreen176, 224, 128
C++ Documentation: Template Parameter: DescriptionPlainDark White176, 176, 176

Older versions

2019

2017

Releases

Packages

Used by

Contributors

Languages