Reputation: 6625
Using Visual Studio 2022 v17.12.1 with the "Dark" colour scheme (set at Tools > Options > Environment > General > Color Theme
).
I've set up various colours in Tools > Options > Environment > Fonts and Colors
. These generally work well (see image below):
if
and for
are purple using the C++ Keyword - Control
colour settingvoid
and int
are blue (unsure which colour setting this uses)5
is red using the Number
colour settingString
colour settingCurrently Visual Studio uses the Plain Text
colour setting for std::string
("param2" in my example above, circled in bright orange), but also for other user types like std::vector
and MyUserType
. The C++ User Types
colour setting looked promising but doesn't appear to work.
My question is whether VS can be configured to give colour to user types such as std::vector
or MyUserType
. This should be distinct from Plain Text
.
Based on the answer from @RemyLebeau, VS 2022 v17.12.1 may not have a working colour setting for C++ user types (or at least the colour rendering engine is not identifying these elements correctly).
After further experimentation, I note that the Type
and Method
colour settings are also not working as expected (at least in C/C++ files). All types and methods are using the Plain Text
colour setting.
Seems likely that the VS colour rendering engine is not working correctly.
Upvotes: 0
Views: 72
Reputation: 597906
std::string
is not a keyword in the C++ language. It is a user-defined class (implemented by the compiler vendor). That is why it doesn't get colored differently than other user-defined code elements. And no, you can't instruct VS to color std::string
as a language item, because it is not one.
Upvotes: 0