Reputation: 51
language : c++
extension: "C/C++ ms-vscode.cpptools V0.9.3"
How can I setup highlighting of code that has been deactivated via a #ifdef in vs code.
vscode is not highlighting/greying-out by default and I can't find a way to activate it.
Upvotes: 5
Views: 11171
Reputation: 61
If you have "C/C++" extension installed on VS Code, it inactivates unused regions in the code. To fix this, go to extensions (Ctrl + Shift + X) -> "C/C++" -> click on the gear (next to the extension description) -> extension settings.
A file will show up. Look for the option "Dim Inactive Regions" and uncheck it.
You're done.
Upvotes: 6
Reputation: 11
in the visual studio go to extension details then go to setting of this extension ms-vscode.cpptools and enable setting for highlighting inactive section there are total 48 settings u can search for inactive.
Upvotes: 1
Reputation: 428
You can now do that! Feb 2018 update for C/C++ extension added that feature: https://devblogs.microsoft.com/cppblog/visual-studio-code-cc-extension-feb-2018-update/
Upvotes: 1
Reputation: 45293
You can't do that. Syntax highlighting in Visual Studio Code is currently performed exclusively by grammar files based on regular expressions.
In order to highlight deactivated code an extension needs to alter the text appearance based on your current setup. Unfortunately there is no API available for that.
You can vote for that feature here: Provide an API for advanced source highlighting
Upvotes: 0