better-cpp-syntax icon indicating copy to clipboard operation
better-cpp-syntax copied to clipboard

C++/CLI syntax highlighting messed up by attributes.

Open sonicfly opened this issue 3 years ago • 1 comments

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:

Screen Shot 2022-10-13 at 13 50 49 Screen Shot 2022-10-13 at 13 51 50

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.

sonicfly avatar Oct 13 '22 20:10 sonicfly

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:

Screen Shot 2022-10-27 at 6 00 14 PM

jeff-hykin avatar Oct 27 '22 23:10 jeff-hykin

(not fixed but also I never found a reference to single-bracket attributes)

jeff-hykin avatar Jul 05 '24 23:07 jeff-hykin