🧠 Smart Folding — WebStorm-Style Code Folding for VS CodeBring JetBrains/WebStorm's beloved folding experience to VS Code: single-line folds, a big clickable
🚀 Features🧩 WebStorm-style single-line foldsA collapsed block renders as one line — the closing bracket is folded away too:
🎯 Function parameters stay visibleParameter lists 🏷️ A real
|
| Command | What it does |
|---|---|
Smart Folding: Fold All (Remember Cursor) |
Folds everything and remembers your exact cursor + scroll |
Smart Folding: Unfold All (Restore Cursor) |
Unfolds everything and jumps back to your cursor |
Smart Folding: Smart Unfold (Reveal Cursor) |
Opens only the blocks containing your cursor |
Smart Folding: Smart Unfold Recursively |
Same, but opens the chain recursively |
💡 You don't have to use these commands — the built-in editor.foldAll / editor.unfoldAll / editor.unfold / editor.unfoldRecursively (with your own keybindings) are detected automatically.
⚙️ Settings
| Setting | Default | Description |
|---|---|---|
smartFolding.enhancedEllipsis |
true |
Show the clickable badge on collapsed blocks |
smartFolding.hideOpeningBracket |
true |
Render collapsed blocks as {...} (hides the real {) |
smartFolding.hideNativeFoldPlaceholder |
true |
🫥 Hides VS Code's built-in ⋯ collapsed-text indicator (makes editor.foldPlaceholderForeground transparent in your global color customizations) |
smartFolding.foldComments |
true |
Fold block comments, JSDoc & // comment runs (never single-line ones) |
smartFolding.commentPreview |
true |
Show the comment's first text line instead of ··· |
smartFolding.commentPreviewLength |
60 |
Max characters of the comment preview |
smartFolding.ellipsisBackground |
#46494e |
Badge background (base) |
smartFolding.ellipsisColor |
#9a9da5 |
Badge text color (base) |
smartFolding.ellipsisBackgroundDark / Light |
"" / #dfe1e5 |
Theme-specific background overrides |
smartFolding.ellipsisColorDark / Light |
"" / #6a6f77 |
Theme-specific text color overrides |
smartFolding.clickToExpand |
true |
Click a collapsed line to expand it |
smartFolding.modifierClickExpandsRecursively |
true |
Alt+click a badge to expand recursively (modifier = editor.multiCursorModifier) |
smartFolding.singleLineFolding |
true |
Fold the closing bracket line too (WebStorm style) |
smartFolding.keepFunctionParamsVisible |
true |
Never fold parameter lists |
smartFolding.rememberCursorOnFoldAll |
true |
Remember cursor + scroll on Fold All |
smartFolding.restoreOnAnyUnfold |
true |
Restore the cursor after any unfold, any shortcut |
smartFolding.smartUnfold |
true |
Enable smart (focus) unfolding |
smartFolding.takeOverFolding |
true |
Register as the default folding range provider |
smartFolding.providerDelay |
2000 |
Delay (ms) before re-registering the provider |
smartFolding.languages |
JS/TS family | Languages the folding provider applies to |
🛠️ Build & Install
npm install
npx @vscode/vsce package # produces smart-folding-1.6.0.vsix
Then in VS Code: Extensions → ⋯ → Install from VSIX…
🧪 Development
npm run compile # tsc -p ./
node --test out/test/*.test.js
The folding scanner and all detection logic live in src/core/folding.ts as pure, unit-tested functions.
📄 License
MIT © 2026 SeyMi