Collapse DefsSelectively collapse function and method definitions in your code using customizable regex patterns — unlike "Fold All" which collapses everything (classes, loops, conditionals, etc.), this extension focuses on just the blocks you care about. 🚀 Usage
This command folds all function definitions in the current file based on the active language. 🎯 Why Use This?Standard "Fold All" (
Collapse Defs only folds what you want — typically just functions and methods, giving you a clean overview of your code's structure without hiding control flow. With creative regex patterns, you can collapse any subset of blocks: only public methods, only async functions, only exported functions — whatever helps you navigate your code. 📋 Supported Languages (Built-in Patterns)The extension comes with default patterns for:
No pattern for your language? Just add a custom regex in settings! ⚙️ ConfigurationCustom Fold PatternsOverride or add fold patterns per language via
The keys are VS Code language IDs (e.g., Debug ModeEnable debug logging to see which lines are being matched:
Output appears in the Collapse To Defs panel (View → Output → select "Collapse To Defs" from dropdown). 🧠 How It WorksThe extension:
One-liners are ignored by design — only actual multi-line blocks get folded. 💡 ExamplesFold only exported TypeScript functions
Fold CSS rule blocks
Fold HTML opening tags
Get creative with your patterns to collapse exactly what you need! 📝 LicenseMIT |