Visual Studio extension: Color C++ Attributes.
Branch | Build Status |
---|---|
2022 |
|
2019 |
|
2017 |
Extension adds options to overwrite colors of certain C++ Attributes.
Extension works in files of ContentType
"C/C++"
, eg .cpp
or .h
files.
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 toAutomatic
.
Default Attributes without extension | Color Attributes with extension enabled |
---|---|
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.
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 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]]
.
If multiline attribute will be split into multiple spans upon classification, it won't be matched at all.
deprecated
and nodiscard
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)]]
.
Assume's expression can be a balanced-token
, eg [[assume(max(a, b) > 0)]]
.
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 |
assume |
Positive | Green | 176, 224, 128 |
assume : Expression |
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 |
- Branch:
2019
- Release:
1.0.2.2+2019
- Download:
Color.Attribute.vsix
- Marketplace:
Color.Attribute (2019)
- Branch:
2017
- Release:
1.0.2.1+2017
- Download:
Color.Attribute.vsix
- Marketplace:
Color.Attribute (2017)