Smart C/C++ comment fold preview engine tailored for Embedded Systems and C/C++.
Features
Inline Brief Fold Previews (Zero-Gap Folding):
When folding any multi-line C/C++ comment or Doxygen banner, an inline preview of the brief title is automatically displayed next to the fold indicator (...) with zero blank line gaps:
/** @req{gpt_clear_external_source,SWFLEX-9,R_GPT_Open} The GPT shall clearing the timer with external sources. */
TEST(R_GPT_TG1, TC_ClearExternalSource)
100% View-Only (Safe Saving):
Does not modify buffer content when folding. File on disk and git diff remain 100% untouched.
Full Comment Boundary Folding:
Standard VS Code C/C++ folding often leaves the closing */ unfolded, creating an unwanted empty line gap. This extension provides complete block comment folding range (including */), code blocks ({ ... }), and preprocessors (#if ... #endif).
Dual-token Header Support:
Native support for /*****...*//** opening headers.
Rule Brief Extraction:
Automatically extracts @brief, requirement tags (@req{...}, @verify{...}), or the first meaningful content line, skipping decorative borders.
Manual 1-Line Compact Banner Toggle (Alt+C / Ctrl+K, Ctrl+B):
Optionally convert comment blocks to a 1-line compact banner with full width and cache restoration.
Configuration
To ensure VS Code always uses complete zero-gap comment folding instead of leaving */ on a visible line, this extension contributes default folding provider settings. You can also explicitly verify or add this to your VS Code settings.json:
{
"[c]": {
"editor.defaultFoldingRangeProvider": "ngxx-fus.c-comment-fold-helper"
},
"[cpp]": {
"editor.defaultFoldingRangeProvider": "ngxx-fus.c-comment-fold-helper"
},
"[cuda-cpp]": {
"editor.defaultFoldingRangeProvider": "ngxx-fus.c-comment-fold-helper"
}
}
Installation
code --install-extension c-comment-fold-helper-0.1.4.vsix
Or in VS Code:
- Open Extensions (Ctrl+Shift+X).
- Click
... (Views and More Actions) in the top-right corner.
- Select Install from VSIX... and pick
c-comment-fold-helper-0.1.4.vsix.
Development & Building
Prerequisites
Environment Setup
Clone the repository:
git clone https://github.com/ngxx-fus/vscode-c-comment-helper.git
cd vscode-c-comment-helper
Install dependencies:
npm install
Building the Project
Running & Debugging
Open this repository folder in VS Code:
code .
Press F5 (or go to Run → Start Debugging).
A new Extension Development Host window will appear with this extension loaded.
Open any .c, .cpp, or .h file to test fold previews or test the compact banner toggle shortcut (Alt+C / Ctrl+K, Ctrl+B).
Packaging .vsix
To package the extension into a distributable .vsix file:
npm run package
This runs @vscode/vsce package and outputs c-comment-fold-helper-<version>.vsix in the project root directory.
Windows
git commit -m "C-CMT-HELPER | $(Get-Date -Format 'MM-dd-yyyy HH:mm:ss') | UPDATE/FIX/FEATURE | <msg>"
Linux
git commit -m "C-CMT-HELPER | $(date +"%D %T") | UPDATE/FIX/FEATURE | <msg>"