OS Version: Windows 10 21H2 (Windows_NT x64 10.0.19044)
Theme: Dark+ (default dark)
Steps to Reproduce:
Create a new file
Set the language to C
Use a #define containing the beginning of a switch block, like in the following example code:
#include <stdio.h>
define DISPATCH() switch (command) {
define INSTRUCTION(i) case (i):
define DISPATCH_END() }
int main(int argc, char* argv[]) {
int command, a, b, r;
scanf("%d %d %d", &command, &a, &b);
DISPATCH()
INSTRUCTION(0)
r = a + b;
break;
INSTRUCTION(1)
r = a - b;
break;
INSTRUCTION(2)
r = a * b;
break;
INSTRUCTION(3)
r = a / b;
break;
default:
r = a;
DISPATCH_END()
printf("%d\n", r);
return 0;
}
4. The highlighting will be wrong. Most of the code in main should be white, but will instead be blue. The difference can be seen easily by removing the line containing `#define DISPATCH() `....
The code itself is completely valid and has thus far not failed to compile in any C compiler I have tried. As far as I can tell, it is completely standards-compliant ANSI C code.
Removing the left/opening brace from that line fixes the issue only partially. Removing `switch` fixes it completely.
Correct(ish) syntax highlighting (without the `#define DISPATCH()`...)
![image](https://user-images.githubusercontent.com/32158431/186361378-dc7a391d-f395-490d-b083-68c609c1a7fa.png)
Incorrect syntax highlighting (with the `#define DISPATCH()`...)
![image](https://user-images.githubusercontent.com/32158431/186361491-d1dc252e-0c48-4ae8-879e-9fd2a8de9594.png)
Originally from @hisahi in https://github.com/microsoft/vscode/issues/159016
Checklist
"C_Cpp.enhancedColorization": "Disabled"
Does this issue occur when all extensions are disabled?: Yes
Steps to Reproduce:
define DISPATCH() switch (command) {
define INSTRUCTION(i) case (i):
define DISPATCH_END() }
int main(int argc, char* argv[]) { int command, a, b, r; scanf("%d %d %d", &command, &a, &b);
}