vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

Do colorization of inactive preprocessor blocks

Open bobbrow opened this issue 8 years ago • 25 comments

Splitting this out from #230 and tagging it for the February release. This feature is achievable using VSCode's text decorations. We still need to investigate whether using text decorations is fast enough to color the whole file, so we won't be implementing all of the colorization features at once.

bobbrow avatar Jan 18 '18 17:01 bobbrow

Yeah, if you want to get rid of the gray, you should set the defines appropriately. One side benefit is that it makes it easier to detect what code is getting skipped by IntelliSense due to incorrect defines.

@sean-mcmanus What is the correct way to set the defines appropriately? Now it's done via ./configure --enable-option.

rvanlaar avatar May 12 '20 15:05 rvanlaar

@rvanlaar It depends on how you're configuring IntelliSense. You could add the defines to c_cpp_properties.json or the setting C_Cpp.default.defines. If you use compileCommands or configurationProvider, then the defaults should come automatically from those.

sean-mcmanus avatar May 13 '20 00:05 sean-mcmanus

Thank you for your comments. I've configured the c_cpp_properties.json via the cpp plugin and generated a compile_commands.json via bear make.

rvanlaar avatar May 13 '20 09:05 rvanlaar

@rvanlaar Then if you have the compileCommands property set, the defines should get picked up from your compile_commands.json. Let us know if that isn't working for you.

sean-mcmanus avatar May 15 '20 00:05 sean-mcmanus

It works.

rvanlaar avatar May 15 '20 09:05 rvanlaar