JSDoc Folder
Automatically collapses JSDoc comment blocks by default when opening JavaScript and TypeScript files.
Why This Extension?
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:
Features
- 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
Usage
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() {}
Configuration
You can configure the extension through VS Code settings:
- Open VS Code Settings (⌘, on macOS or Ctrl+, on Windows/Linux)
- Search for "JSDoc Folder"
- Find the following settings:
jsdocFolder.autoFold
: Enable/disable automatic folding of JSDoc comments
true
(default): Automatically fold JSDoc comments when opening files
false
: Leave JSDoc comments unfolded
You can also directly edit settings.json:
Requirements
- Visual Studio Code ^1.80.0
- Node.js >= 14.x
Development
- 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
Building and Testing
- Package the extension:
bun run package
# or
npm run package
- The above command will generate a
.vsix
file that you can install locally:
code --install-extension fold-jsdoc-0.0.1.vsix
License
MIT