Region Folding Utilities
Version française disponible ici : README_FR.md
A VS Code extension to enhance region management in files with folding and line counting utilities.
Note : .txt files doesn't work well, since they don't have a syntax for line comments

🚀 Features
This extension provides practical tools to manage code regions in your SQL files:
- 🔄 Fold & Sync All Regions: Automatically updates line count in all regions and folds them
- ➕ Sync Line Count into Region Markers: Adds or updates line count in region markers
- 📂 Unfold All Regions: Unfolds all regions in the file
- 🖱️ Context menu: Quick access to all commands via right-click
🛠️ Installation
Via VS Code Marketplace
- Open VS Code
- Go to Extensions (
Ctrl+Shift+X
)
- Search for "Region Folding Utilities"
- Click "Install"
Manual Installation
- Download the
.vsix
file from releases
- Open VS Code
- Go to Extensions (
Ctrl+Shift+X
)
- Click the three dots (...) and select "Install from VSIX..."
- Select the downloaded file
📖 Usage
The extension recognizes regions in the following format:
-- #region Region name
SELECT * FROM table1;
SELECT * FROM table2;
-- #endregion
After using the "Sync Line Count into Region Markers" command, this becomes:
-- #region Region name (2 lines inside)
SELECT * FROM table1;
SELECT * FROM table2;
-- #endregion
Available Commands
🔄 Fold & Sync All Regions
Updates line count in all regions and folds them automatically.
Access:
- Command Palette:
Ctrl+Shift+P
→ "Fold & Sync All Regions"
- Context menu: Right-click in an SQL file
➕ Sync Line Count into Region Markers
Adds or updates line count between #region
and #endregion
markers.
Access:
- Command Palette:
Ctrl+Shift+P
→ "Sync Line Count into Region Markers"
- Context menu: Right-click in an SQL file
📂 Unfold All Regions
Unfolds all regions in the active file.
Access:
- Command Palette:
Ctrl+Shift+P
→ "Unfold All Regions"
- Context menu: Right-click in an SQL file
📸 Screenshots

Unfolded code

Folded code with line count

⚙️ Configuration
No special configuration is required. The extension works automatically with SQL files.
🐛 Known Issues
- Currently limited to SQL files only
- Regions must follow the exact format
-- #region
and -- #endregion
🤝 Contributing
Contributions are welcome! Feel free to:
- Fork the project
- Create a 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
📝 License
This project is licensed under the MIT License. See the LICENSE file for details.
🗺️ Roadmap
- [ ] Support for other languages (JavaScript, TypeScript, C#, etc.)
- [ ] Customizable region format configuration
- [ ] Configurable keyboard shortcuts
- [ ] Improved automatic region detection
⭐ If this extension helps you, don't hesitate to give it a star on GitHub!