Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>ShowFlagsNew to Visual Studio Code? Get it now.
ShowFlags

ShowFlags

PEW's Corner

|
3,395 installs
| (1) | Free
Shows C/C++ preprocessing conditions for current source code line
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

ShowFlags - Visual Studio Code Extension

The ShowFlags extension displays a status bar item (for C/C++ files only) which continuously shows all preprocessing conditions (a.k.a. flags - determined by surrounding #if/#ifdef directives) that apply to the line of code where the cursor is located.

Alternatively, the "ShowFlags: Report" command may be used to output a more verbose one-time report of the same information to the ShowFlags channel in the Output pane.

Displaying Flags in Status Bar

Set "showflags.enableStatusBarDisplay" to false to disable this (e.g. if your status bar is too crowded).

The following snapshot shows the cursor on line 7 which will only be compiled when both of the following conditions are true:

  • !(defined(FLAG1))
  • FLAG2 == 5 || FLAG3 != FLAG4

Therefore, the ShowFlags extension shows those two conditions in the status bar as a breadcrumb trail (each preceded by a triangle).

capture1

Note: If there is a preprocessor directive on the current line (where the cursor is located) and/or on any lines joined (with backslash-escaped newlines or multiline comments) to the current line, the conditions shown in the status bar reflect the state after this directive has been interpreted in its entirety.

Note: VS Code may hide the entire ShowFlags status bar item (or other items) if there is insufficient room in the status bar. If this happens, the "ShowFlags: Report" command is an alternative way to get the information (see below).

Displaying Flags in Output Pane

Use the "ShowFlags: Report" command (via View -> Command Palette or by clicking on the ShowFlags status bar item) to output a more verbose one-time report to the ShowFlags channel in the Output pane. This report contains basically the same information as the status bar item (but it will not change dynamically when the cursor moves).

capture4

Tip: Use this approach if there is more information than will fit in the status bar, or if you want to copy the information to the clipboard.

Errors

If the ShowFlags extension fails to show the preprocessor conditions due to a directive error in the portion of the file from line 1 down to and including the line where the cursor is located, an appropriate error message will be displayed in the status bar (and/or output pane).

capture3

Tab Warnings

Set "showflags.showTabWarning" to true to enable this.

If there are any tab characters in the portion of the file from line 1 down to and including the line where the cursor is located, the status bar (and/or output pane) will show the line number of the last such tab character.

capture2

Tip: Place the cursor at the end of the file to check the whole file for tab characters.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft