Function Folding

A powerful VS Code extension that provides smart function folding capabilities for JavaScript, TypeScript, and Python files. Focus on your code structure by folding only function definitions while keeping other code blocks visible.
✨ Features
- 🎯 Function-only folding: Intelligently fold only function definitions
- 🔍 Smart pattern matching: Supports all modern JavaScript/TypeScript function patterns
- ⚡ Quick shortcuts: Fold/unfold with customizable keyboard shortcuts
- 📱 Context menu: Right-click integration for easy access
- 🌐 Multi-language support: Works with JS, TS, JSX, TSX, and Python files
- 🎨 Clean interface: Seamless integration with VS Code's native folding
Supported Function Patterns
JavaScript & TypeScript:
- Regular function declarations:
function myFunction() {}
- Arrow functions:
const myFunc = () => {}
- Method shorthand:
{ methodName() {} }
- Class methods:
class MyClass { method() {} }
- Async functions:
async function myAsyncFunc() {}
- TypeScript methods with modifiers:
public async method(): Promise<void> {}
- Export functions:
export function myFunc() {}
Python:
- Function definitions:
def my_function():
- Async functions:
async def my_async_function():
- Class methods:
def method(self):
- Static methods:
@staticmethod def my_method():
- Class methods:
@classmethod def my_method(cls):
- Decorated functions:
@decorator def my_function():
🚀 Quick Start
- Install the extension from the VS Code Marketplace
- Open any JavaScript, TypeScript, or Python file
- Use
Ctrl+Alt+F
(Windows/Linux) or Cmd+Alt+F
(Mac) to fold all functions
- Use
Ctrl+Alt+U
(Windows/Linux) or Cmd+Alt+U
(Mac) to unfold all functions
📋 Usage
Commands
Command |
Shortcut (Windows/Linux) |
Shortcut (Mac) |
Description |
Fold All Functions |
Ctrl+Alt+F |
Cmd+Alt+F |
Fold all function definitions in the active file |
Unfold All Functions |
Ctrl+Alt+U |
Cmd+Alt+U |
Unfold all folded regions in the active file |
Right-click in any JavaScript, TypeScript, or Python file to access folding commands from the context menu.
Command Palette
- Open Command Palette (
Ctrl+Shift+P
/ Cmd+Shift+P
)
- Type "Function Folding" to see available commands
🎬 Demo

Quickly fold and unfold functions to focus on the code structure you need.
📦 Installation
From VS Code Marketplace
- Open VS Code
- Go to Extensions view (
Ctrl+Shift+X
/ Cmd+Shift+X
)
- Search for "Function Folding"
- Click Install
Manual Installation
# Download the latest .vsix file from releases
code --install-extension function-folding-1.0.0.vsix
⚙️ Configuration
The extension works out of the box with no configuration needed. However, you can customize the keyboard shortcuts:
- Go to File → Preferences → Keyboard Shortcuts
- Search for "Function Folding"
- Modify the keybindings as needed
🛠️ Development
Prerequisites
- Node.js (v16 or higher)
- VS Code (v1.74.0 or higher)
Setup
# Clone the repository
git clone https://github.com/your-username/function-folding.git
cd function-folding
# Install dependencies
npm install
# Compile TypeScript
npm run compile
# Watch mode for development
npm run watch
Testing
# Run linting
npm run lint
# Compile and run tests
npm run test
Building
# Build for production
npm run vscode:prepublish
# Package the extension
vsce package
🤝 Contributing
We welcome contributions! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
)
- Commit your changes (
git commit -m 'Add amazing feature'
)
- Push to the branch (
git push origin feature/amazing-feature
)
- Open a Pull Request
Issues
Found a bug or have a feature request? Please open an issue with:
- Clear description of the problem or feature
- Steps to reproduce (for bugs)
- Expected vs actual behavior
- Screenshots if applicable
📝 Changelog
[1.0.0] - 2025-01-07
Added
- Initial release
- Function folding for JavaScript and TypeScript files
- Support for various function declaration patterns
- Keyboard shortcuts (
Ctrl+Alt+F
/ Cmd+Alt+F
for fold, Ctrl+Alt+U
/ Cmd+Alt+U
for unfold)
- Context menu integration
- Multi-language support (JS, TS, JSX, TSX, Python)
🔧 Troubleshooting
Common Issues
Q: The extension doesn't fold my functions
A: Make sure you're in a supported file type (JS, TS, JSX, TSX, Python). Check that your functions match the supported patterns.
Q: Keyboard shortcuts don't work
A: Check if there are conflicting keybindings in your VS Code settings. You can customize them in the Keyboard Shortcuts settings.
Q: Some functions aren't detected
A: Please report an issue with the function pattern that isn't working.
📄 License
This extension is licensed under the MIT License.
🙏 Acknowledgments
- Thanks to the VS Code team for the excellent extension API
- Inspired by the community's need for better code folding tools
- Built with ❤️ for the developer community
Enjoy using Function Folding! ⭐ If you find this extension useful, please consider leaving a review on the VS Code Marketplace.