Skip to content
| Marketplace
Sign in
Visual Studio>Tools>Color.Attribute (2022)

Color.Attribute (2022)

Paweł Benetkiewicz

|
2,579 installs
| (0) | Free
Color C++ Attributes.

Color.Attribute

Visual Studio extension: Color C++ Attributes.

Status

Branch Build Status
2022 Build status
2019 Build status
2017 Build status

Description

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

Usage

New entries will appear in Tools → Options → Environment → Fonts and Colors → Text Editor.
Each will begin with C++ Attribute: 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 Attributes without extension Color Attributes with extension enabled

Limitations

In order to provide fast execution, some rare syntax patterns are not supported by extension right now. There are no plans to waive those restrictions until intellisense shall classify C++ attributes.

Nested [[ & ]]

Due to high cost of parsing balanced-token, extension non greedily matches anything between [[ and ]] in SnapshotSpan, splits content by , and trims, then finally matches standard attributes. Thus, attribute containing nested double squares can be incorrectly colored, eg [[test::covered([[likely]])]].

Comments

Comments in attributes are not supported. They are treated as text for faster execution. This can cause some attributes to be incorrectly colored, eg [[using/*civ1*/civ2: fast, nodiscard]].

Multiline attributes

If multiline attribute will be split into multiple spans upon classification, it won't be matched at all.

deprecated reason

deprecated attribute's reason, if present, must be enclosed in ", and such created string-literal can be prefixed by any number of characters different than ", eg [[deprecated(u8"Use API v2 instead.")]], but not [[deprecated(CMacro_Reason)]].

Contract expression

Contract's expression can not contain ]]. Parsing expression could be too complex and expensive for this simple extension, eg [[ensures axiom R: Internal::TextDB::EntryExists("[[" + R + "]]")]].

List of Attributes

Extension exposes all Standard Attributes for customization.

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

Attribute entry Type Color RGB (0 – 255)
C++ Attribute Plain Dark White 176, 176, 176
carries_dependency Keyword Blue 128, 176, 224
deprecated Warning Yellow 224, 224, 128
deprecated: Reason String Red 224, 128, 128
fallthrough Flow Violet 128, 128, 224
likely Positive Green 128, 224, 128
maybe_unused Warning Yellow 224, 224, 128
no_unique_address Keyword Blue 128, 176, 224
nodiscard Keyword Blue 128, 176, 224
nodiscard: Reason String Red 224, 128, 128
noreturn Warning Yellow 224, 224, 128
optimize_for_synchronized Keyword Blue 128, 176, 224
unlikely Negative Red 224, 128, 128
Contract: assert Warning Yellow 224, 224, 128
Contract: ensures Positive Green 176, 224, 128
Contract: ensures: Identifier Plain Dark White 176, 176, 176
Contract: expects Negative Red 224, 128, 128
Contract: Expression Plain Dark White 176, 176, 176
Contract: Level: audit Warning Yellow 224, 224, 128
Contract: Level: axiom Positive Green 176, 224, 128
Contract: Level: default Negative Red 224, 128, 128
Punctuation Punct Gray 128, 128, 128
Punctuation: [[ & ]] Punct Gray 128, 128, 128

Older versions

2019

  • Branch: 2019
  • Release: 1.0.2.2+2019
  • Download: Color.Attribute.vsix
  • Marketplace: Color.Attribute (2019)

2017

  • Branch: 2017
  • Release: 1.0.2.1+2017
  • Download: Color.Attribute.vsix
  • Marketplace: Color.Attribute (2017)
  • Contact us
  • Jobs
  • Privacy
  • Terms of use
  • Trademarks
© 2022 Microsoft