Open leidegre opened 7 months ago
Hi @leidegre . The C/C++ Extension internally uses the same IntelliSense engine as Visual Studio. Currently, we don't get sufficient information from IntelliSense to distinguish between enum member declaration and use. I can open an issue for this internally (1999248). Or, if you'd like to open an issue against Visual Studio on The Visual Studio Developer Community web site, that might provide you a more direct way to track this.
If you don't mind, I think an internal issues will gather more attention. That said, can this be solved if you combine the knowledge of textmate scopes and semantic tokens? I haven't found a way to do that through configuration but can the semantic token provider take textmate scopes into account?
I've never written a semantic token provider so I'm unsure of its capabilities but in this case the token will have the textmate scope meta.enum.definition.cpp
that in combination with semantic token type enumMember
should be enough to add a modifier but it all hinges on whether the semantic token provider can do something like that.
Feature Request
Right now, enums have the semantic token type enumMember but without modifiers. I'd like to distinguish between declaration and usage.
In my color theme, I have opted to use a green color for constants. I'd like it so that I could make enum usage be green but usage only. Not the enum declaration/definition.
This is what's currently possible:
I can apply my green color to the enumMember sematic token.
However, that makes the enum definition also green which I don't want. Here you can see that green is applied on both sides of the equals sign.
I'd like this to stay like this
But there's no way to accomplish this without a semantic token modifier. I've tried TextMate scope mappings and contribution points to as a workaround but it's not possible and I cannot disable semantic highlighting because it will just lead to other issues. The semantic highlighting rules takes precedence.
I would really appreciate if we could get a declaration modifier for enums, so that I can have my enum declaration appear in a my natural foreground color but when used as a literal constant value, use my green color.