better-cpp-syntax
better-cpp-syntax copied to clipboard
C++/CLI syntax highlighting messed up by attributes.
Checklist
- [X] This problem exists even with the setting
"C_Cpp.enhancedColorization": "Disabled"
The code with a problem is:
[LinuxExcluded]
[Description("For testing")]
public ref class TestClass
...
It looks like:

It should look like:
It should looks like the second screenshot. Seems the C++/CLI attributes will mess up the quotation detection and everything becomes red color after. And also single attribute seems OK (as the second screenshot shows). This issue doesn't happen if I disable the better-cpp-syntax plugin, but irrelevant to C_Cpp.enhancedColorization setting. And this issue shows up recently, not sure it is caused by VSCode or better-cpp-syntax plugin update, but I don't remember having this issue before.
Thats strange if its a recent change, but disabling the extension means it probably is.
The color issue is happening because [LinuxExcluded] looks like the start of a lambda.
I didn't know attributes could start with only a single bracket. Is there a link to the specification so I can make sure to cover all the syntax cases? Something like:
(not fixed but also I never found a reference to single-bracket attributes)