This extension integrates the keepsorted CLI with Visual Studio Code. It formats and checks structured lists so your files stay consistently ordered while comments remain attached to their items.
Requirements
Install the keepsorted command line tool. If you have Rust installed this can be done with:
cargo install keepsorted --version 0.1.7
Prebuilt binaries are also available from the project releases.
Why use it?
Keep diffs small and easy to review
Maintain consistent ordering without losing comments
Quickly fix entire projects or only the sections you select
Commands
Keepsorted: Format Selection – sort the selected lines
Keepsorted: Format Document – sort the current file
Keepsorted: Format Workspace – sort all tracked files in the workspace
Keepsorted: Check Selection – check the selected lines for unsorted items
Keepsorted: Check Document – check the current file
Keepsorted: Check Workspace – check the entire workspace
Keepsorted: Show Info – show extension and CLI information
Amount of output written to the Keepsorted channel
Build and Install
npm ci # installs dependencies and compiles the extension
npm test
npm run build
The build step creates a .vsix package in the repository root. In VS Code run Extensions: Install from VSIX... and select that file to install the extension locally.