A VS Code/Cursor extension that formats CMake files using gersemi.
Requirements
pip install gersemi
Features
- Format CMake files (
CMakeLists.txt and *.cmake)
- Format on save support (enable
editor.formatOnSave in VS Code settings)
- Configurable line width and gersemi path
Extension Settings
| Setting |
Description |
Default |
cmakeFormatter.gersemiPath |
Path to the gersemi executable |
gersemi |
cmakeFormatter.lineWidth |
Maximum line width for formatting |
80 |
Usage
- Open a CMake file (
CMakeLists.txt or *.cmake)
- Use
Format Document command (Shift+Alt+F on Windows/Linux, Shift+Option+F on macOS)
- Or enable format on save in your settings:
{
"editor.formatOnSave": true
}
Development
# Install dependencies
npm install
# Compile
npm run compile
# Watch for changes
npm run watch
# Package extension
npm run package
| |