Rolf
Rolf

Reputation: 51

vs code - inactive code highlighting

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

Answers (4)

matheus ribeiro
matheus ribeiro

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

InrimUltimate
InrimUltimate

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

Jim Balkwill
Jim Balkwill

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

Wosi
Wosi

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

Related Questions