Why does syntax highlighting look different in C/C++ Dimmed Inactive Regions (#ifdef) #8135
-
I have a C file which contains multiple But that's not all. Apart from that, the syntax highlighting is different for the sections of code that are dimmed. I want to turn this behavior off so that all of my C code looks the same (not dim, same syntax highlighting), independent from preprocessor directives. How to achieve that? You can see that some words are displayed in white inside the dimmed sections of code instead of light blue. If I disabled the Why is that the case? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
The coloring is based on how the file compiles. Because those sections are inactive, our IntelliSense compiler skips over them and we do not get detailed information about those tokens. The colors you get in those sections are based solely on the C/C++ grammar and not based on any additional "semantic" information. |
Beta Was this translation helpful? Give feedback.
-
Hi @theFireProject . The differences you are seeing are likely due to semantic highlighting. That provides colorization based on semantic analysis (compilation) of the source code. Blocks of code that are inactive are not compiled, so not considered for semantic highlighting. You could disable semantic highlighting globally with |
Beta Was this translation helpful? Give feedback.
Hi @theFireProject . The differences you are seeing are likely due to semantic highlighting. That provides colorization based on semantic analysis (compilation) of the source code. Blocks of code that are inactive are not compiled, so not considered for semantic highlighting. You could disable semantic highlighting globally with
editor.semanticHighlighting.enabled
, or just for the C/C++ extension using"C_Cpp.enhancedColorization": "Disabled"
.