Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Preprocessor Section SelectNew to Visual Studio Code? Get it now.
Preprocessor Section Select

Preprocessor Section Select

AllenCY

|
1 install
| (0) | Free
Select and navigate preprocessor sections (#ifdef/#if/#else/#endif) with triple-click or keyboard shortcut.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Preprocessor Section Select

A VS Code extension that provides Source Insight-like functionality for selecting and navigating preprocessor sections (#ifdef/#if/#else/#endif).

Features

  • Triple-Click Selection: triple-click on any preprocessor directive to select the entire block (enabled by default, configurable)
  • Select Preprocessor Section: select the entire preprocessor block
  • Go to Matching Preprocessor: jump between matching preprocessor directives

Supported Directives

  • #if
  • #ifdef
  • #ifndef
  • #elif
  • #else
  • #endif
  • #if defined(...)

Supported Languages

  • C
  • C++
  • Objective-C
  • Objective-C++

Keybindings

Action Keybinding
Select Section NA (manual setting)
Go to Match NA (manual setting)

Installation

From VSIX File

  1. Download the .vsix file from Releases
  2. Run: code --install-extension preproc-select-*.vsix

From Source

# Clone the repository
git clone https://github.com/allen840707/vscode-preproc-select.git
cd vscode-preproc-select

# Install dependencies
npm install

# Compile TypeScript
npm run compile

# Package the extension
npm run package

Then install the generated .vsix file.

Publish to Marketplace

# Install vsce if not already installed
npm install -g vsce

# Package and publish
npm run package
npm run publish

Usage

Select Preprocessor Section

  1. Place cursor on a preprocessor line (#if, #ifdef, #else, #endif, etc.)
  2. execute command - Select Preprocessor Section
  3. The entire preprocessor block will be selected

Navigate Between Directives

  1. Place cursor on any preprocessor directive
  2. Execute command - Go to Matching Preprocessor
  3. Jump to the matching directive:
    • From #if → first #else/#elif or #endif
    • From #else → #endif
    • From #endif → corresponding #if

Testing

Run the included test script to verify correctness:

npm test

Configuration

The extension automatically activates for C/C++ files.

Triple-Click Feature

The triple-click feature is enabled by default. To disable it, add the following to your VS Code settings (settings.json):

{
    "preproc-select.enableTripleClick": false
}

License

MIT

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