VS Code Extensions
ifelse Match Highlight

ifelse Match Highlight

by tianzhiying

Highlight matching #if/#else/#elif/#endif when cursor is on a C preprocessor directive

Downloads

26

Rating

— (0)

Version

1.0.1

Last updated

Jul 02, 2026

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

Related extensions