Never lose track of which
ifstatement you're closing again! π―
A lightweight VS Code extension that displays subtle, inline markers showing the condition of if statements at their closing braces. Perfect for navigating complex conditional logic in JavaScript, TypeScript, C, and C++ projects.
Ever found yourself scrolling up to remember what condition that closing brace belongs to? If-End Marker solves this by displaying the original condition right where you need it - at the closing brace.
if (user.isAuthenticated &&
user.hasPermission('admin') &&
!user.accountLocked) {
// ... 50 lines of code ...
performAdminAction();
updateAuditLog();
} // user.isAuthenticated && user.hasPermission('admin') &&...
β This appears automatically!- π Smart Detection: Automatically shows markers for multi-line if statements
- π¨ Theme Integration: Markers adapt to your VS Code theme using native inlay hint colors
- β‘ Blazing Fast: Optimized for large codebases with smart caching and viewport rendering
- π οΈ Fully Configurable: Customize when and how markers appear
- π Multi-language Support: Works with JS, TS, JSX, TSX, MJS, CJS, C, and C++ files
- Open VS Code
- Press
Ctrl+P/Cmd+Pto open the Quick Open dialog - Type
ext install shipkit.vscode-if-end-marker - Press Enter
- Download the latest
.vsixfile from the Releases page - Open VS Code
- Press
Ctrl+Shift+P/Cmd+Shift+P - Type "Install from VSIX" and select the command
- Choose the downloaded
.vsixfile
-
Clone this repository:
git clone https://github.com/lacymorrow/vscode-if-end-marker.git cd vscode-if-end-marker -
Install dependencies:
npm install
-
Compile the extension:
npm run compile
-
Package and install:
npm run package code --install-extension vscode-if-end-marker-*.vsix
The extension activates automatically when you open JavaScript, TypeScript, C, or C++ files. Markers will appear at the end of if statements that span multiple lines.
Access these commands through the Command Palette (Ctrl+Shift+P / Cmd+Shift+P):
- If-End Marker: Toggle Markers - Toggle the extension on/off
- If-End Marker: Enable Markers - Enable the extension
- If-End Marker: Disable Markers - Disable the extension
if (userIsLoggedIn &&
hasPermission &&
!isExpired) {
// Your code here
performAction();
updateUI();
} // userIsLoggedIn && hasPermission &&...Configure the extension through VS Code settings (Ctrl+, / Cmd+,):
| Setting | Type | Default | Description |
|---|---|---|---|
vscodeIfEndMarker.enabled |
boolean | true |
Enable/disable the extension |
vscodeIfEndMarker.maxConditionLength |
number | 50 |
Maximum characters to display from the condition |
vscodeIfEndMarker.maxFileSize |
number | 500000 |
Maximum file size (in characters) to process |
vscodeIfEndMarker.debounceDelay |
number | 300 |
Delay in milliseconds before updating decorations |
vscodeIfEndMarker.minLineCount |
number | 4 |
Minimum lines an if statement must span |
{
"vscodeIfEndMarker.enabled": true,
"vscodeIfEndMarker.maxConditionLength": 60,
"vscodeIfEndMarker.maxFileSize": 1000000,
"vscodeIfEndMarker.debounceDelay": 400,
"vscodeIfEndMarker.minLineCount": 3
}The extension is optimized for performance with:
- Caching: Parse results are cached and reused when possible
- Viewport-based rendering: Only processes visible code
- Debouncing: Updates are delayed during rapid typing
- File size limits: Large files can be automatically skipped
- Optimized parsing: Uses efficient string operations and pre-compiled regex
- For very large files, increase
maxFileSizeor set to0to disable the limit - Increase
debounceDelayif you experience lag during typing - Adjust
minLineCountto control when markers appear
- Node.js 16.x or higher
- VS Code 1.74.0 or higher
# Install dependencies
npm install
# Compile TypeScript
npm run compile
# Watch for changes
npm run watch
# Run linting
npm run lint
# Package extension
npm run package# Run tests
npm testThis project uses automated versioning and changelog generation based on commit messages.
# Automatic version bump based on commits
npm run release
# Force specific version bump
npm run release:patch # 1.0.0 -> 1.0.1
npm run release:minor # 1.0.0 -> 1.1.0
npm run release:major # 1.0.0 -> 2.0.0Follow Conventional Commits:
feat: Add new featureβ Minor version bumpfix: Fix bugβ Patch version bumpfeat!: Breaking changeβ Major version bumpperf: Improve performanceβ Patch version bumpdocs: Update READMEβ No version bumpchore: Update dependenciesβ No version bump
Contributions are welcome! Please read our Contributing Guidelines before submitting PRs.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Make your changes
- Run
npm run compileto build - Press
F5in VS Code to launch a new Extension Development Host - Test your changes
- Run
npm run lintto check for issues
- Complex nested if statements may not always be parsed correctly
- The parser uses a regex-based approach which may miss some edge cases
- Conditions containing string literals with parentheses might be truncated incorrectly
- Check if the extension is enabled in settings
- Ensure your if statement spans at least 4 lines (configurable)
- Verify the file type is supported (JS/TS/JSX/TSX/C/C++)
- Try reloading VS Code (
Ctrl+R/Cmd+R)
If you experience performance issues with large files:
- Consider increasing
vscodeIfEndMarker.maxFileSize - Temporarily disable the extension for very large files
- Report the issue with file details
See the Releases page for a full changelog. Each release includes:
- Automated changelog from commit messages
- Pre-built
.vsixfile for manual installation - Source code archives
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by similar features in JetBrains IDEs
- Built with the VS Code Extension API
- Theme-aware styling adapted from VS Code's inlay hints
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Marketplace: VS Code Marketplace Page
Made with β€οΈ by Shipkit β’ Lacy Morrow


