Automatically collapses JSDoc comment blocks by default when opening JavaScript and TypeScript files.
JSDoc comments can take up significant vertical space in your code editor. Long documentation blocks often make it harder to navigate and understand the actual code structure. This extension solves that problem by automatically folding JSDoc comments while preserving their first line, giving you the best of both worlds:
- Automatically folds JSDoc comment blocks when opening files
- Preserves the first line
(/** */)
for visibility - Supports JavaScript, TypeScript, JSX, and TSX files
- Configurable through VS Code settings
JSDoc comments will be automatically folded when you open a file:
/** This line stays visible
* These lines will be
* automatically folded
* when you open the file
*/
function example() {}
You can configure the extension through VS Code settings:
- Open VS Code Settings (
⌘ + ,
on macOS orCtrl + ,
on Windows/Linux) - Search for "
JSDoc Folder
" - Find the following settings:
jsdocFolder.autoFold
: Enable/disable automatic folding of JSDoc commentstrue
(default): Automatically fold JSDoc comments when opening filesfalse
: Leave JSDoc comments unfolded
You can also directly edit settings.json
:
- Visual Studio Code ^1.80.0
- Node.js >= 14.x
- Clone the repository:
git clone https://github.com/aydgn/fold-jsdoc.git
cd fold-jsdoc
- Install dependencies:
bun install
# or
npm install
- Open VS Code:
code .
- Press
F5
to launch the Extension Development Host- This opens a new VS Code window with your extension loaded
- Open any JavaScript/TypeScript file with JSDoc comments to test
- Package the extension:
npm run package
- The above command will generate a
.vsix
file that you can install locally:
code --install-extension fold-jsdoc-X.X.X.vsix