Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>ifelse Match HighlightNew to Visual Studio Code? Get it now.
ifelse Match Highlight

ifelse Match Highlight

tianzhiying

|
2 installs
| (0) | Free
Highlight matching #if/#else/#elif/#endif when cursor is on a C preprocessor directive
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

ifelse Match Highlight

Version License

When your cursor lands on a C/C++ preprocessor directive (#if, #ifdef, #ifndef, #else, #elif, #endif), all matching directives in the same block are highlighted simultaneously — even across hundreds of lines.

Preview

demo

Features

  • Auto-detect matching #if / #else / #elif / #endif pairs
  • Highlight the entire directive chain at once (not just jump to one)
  • Works with nested preprocessor blocks (correctly handles stacking)
  • Supports C, C++, GNU Assembly (.S / .s), and any file with #if directives
  • Configurable highlight colors
  • Lightweight — zero dependencies, pure VS Code API

Why this extension?

VS Code's built-in bracket matching can jump between #if and #endif (Ctrl+Shift+), but it doesn't show you the whole picture at a glance. This extension highlights the entire #if → #else → #endif chain simultaneously, so you can instantly see the structure of complex conditional compilation blocks.

Installation

Search ifelse Match Highlight in the VS Code Extensions panel, or install via command line:

code --install-extension ifelse-match-highlight.vsix

Configuration

Setting Default Description
ifelseMatchHighlight.enabled true Enable/disable the extension
ifelseMatchHighlight.decorationColor rgba(255, 200, 0, 0.2) Background color of highlighted lines
ifelseMatchHighlight.borderColor rgba(255, 180, 0, 0.8) Border color of highlighted lines

License

MIT

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