Auto Fold 📂
A powerful VS Code extension that automatically folds newly opened files according to preconfigured folding levels, helping you better organize and navigate your code.
中文文档
✨ Features
- 🚀 Auto Folding: Automatically fold code according to configured levels when opening files
- ⚡️ Fast Response: Execute folding operations immediately after file opening
- 🎯 Precise Control: Support for configuring multiple folding levels
- 🔧 Flexible Configuration: Customizable folding delay time
- 💡 Smart Recognition: Support for all file types with code folding capabilities
📥 Installation
- Open VS Code
- Press
Cmd+P
(macOS) or Ctrl+P
(Windows/Linux) to open the command palette
- Type
ext install auto-fold
and press Enter
- Click the "Install" button to install the extension
- Reload VS Code to activate the extension
Alternatively, you can visit the VS Code Marketplace to install this extension directly.
⚙️ Configuration
The extension provides the following configuration options:
autoFold.foldLevelOnOpen
Defines the array of folding levels to apply when files are opened.
- Type:
number[]
- Default:
[1]
- Range:
1-7
- Examples:
[1]
- Fold only the first level
[1, 2]
- Fold the first and second levels
[1, 2, 3]
- Fold the first three levels
[]
or [0]
- Disable auto folding
autoFold.openDelayMs
Defines the delay time to wait before executing folding operations after files are opened.
- Type:
number
- Default:
300
- Unit: milliseconds
- Range:
0-5000
🚀 Usage
- After installing and enabling the extension, it will automatically take effect
- Open any file that supports code folding
- The extension will automatically fold code blocks according to your configuration
- You can manually adjust the folding state at any time using VS Code's fold/unfold commands
👨💻 Development Guide
Development Environment Setup
- Clone the repository and install dependencies:
git clone https://github.com/yourusername/auto-fold.git
cd auto-fold
pnpm install
- Open the project in VS Code
- Press
F5
to start debugging mode
Available Development Commands
Compile:
pnpm run compile
Watch Mode:
pnpm run watch
Linting:
pnpm run lint
Type Checking:
pnpm run check-types
Run Tests:
pnpm run test
Packaging and Publishing
Package the extension:
pnpm run package
Publish the extension:
pnpm run publish
Note: Please ensure you have updated the version number and passed all tests before publishing.
🤝 Contribution Guidelines
We welcome all forms of contributions, including but not limited to:
- 🐛 Bug reports
- 💡 Feature suggestions
- 📝 Documentation improvements
- 🔧 Code fixes
- ✨ New feature implementations
Steps for Submitting a PR
- Fork this repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
)
- Commit your changes (
git commit -m 'Add some AmazingFeature'
)
- Push to the branch (
git push origin feature/AmazingFeature
)
- Open a Pull Request
Code of Conduct
- Be friendly and professional
- Describe your changes in detail
- Follow the existing code style
- Add necessary tests
- Update relevant documentation
📝 Changelog
1.0.0 (2025-10-10)
- 🎉 Initial release
- ✨ Implemented basic auto-folding functionality
- ⚙️ Added custom configuration options
- 📚 Completed basic documentation
📄 License
This project is licensed under the MIT License - see the LICENSE file for details