A code formatting extension for DevToys 2.0 that supports 34 programming languages with automatic live formatting.
- Live Auto-Format: Code is automatically formatted as you type (500ms debounce)
- 34 Languages: Python, JavaScript, TypeScript, JSON, Markdown, TOML, CSS, SCSS, Less, HTML, Vue, Svelte, Astro, YAML, GraphQL, Dockerfile, Java, SQL, C, C++, C#, Go, Go Assembly, Shell/Bash, Lua, R, Delphi/Pascal, Kotlin, Perl, PHP, MATLAB, Ruby, Objective-C, Haskell
- No External Dependencies: All formatters are bundled as native binaries
- Per-Language Settings: Configure formatting options for each language
- Swap & Clear: Quickly swap input/output or clear both editors
- File Loading: Load code directly from files
| Language | Formatter | Notes |
|---|---|---|
| Python | Ruff | Bundled binary |
| JavaScript | dprint | Bundled binary |
| TypeScript | dprint | Bundled binary |
| JSON | dprint | Bundled binary |
| Markdown | dprint | Bundled binary |
| TOML | dprint | Bundled binary |
| CSS | dprint | Bundled binary |
| SCSS | dprint | Bundled binary |
| Less | dprint | Bundled binary |
| HTML | dprint | Bundled binary |
| Vue | dprint | Bundled binary |
| Svelte | dprint | Bundled binary |
| Astro | dprint | Bundled binary |
| YAML | dprint | Bundled binary |
| GraphQL | dprint | Bundled binary |
| Dockerfile | dprint | Bundled binary |
| Java | google-java-format | Native GraalVM binary |
| SQL | sqruff | Native Rust binary |
| C | clang-format | Bundled binary |
| C++ | clang-format | Bundled binary |
| C# | CSharpier | Bundled binary |
| Go | gofumpt | Bundled binary |
| Go Assembly | asmfmt | Bundled binary |
| Shell/Bash | shfmt | Bundled binary |
| Lua | StyLua | Bundled binary |
| R | air | Bundled binary |
| Delphi/Pascal | pasfmt | Bundled binary |
| Kotlin | ktlint | Bundled binary |
| Perl | Perl::Tidy | Bundled binary |
| PHP | PHP-CS-Fixer | Bundled binary |
| MATLAB | MH Style | Bundled binary |
| Ruby | Rufo | Bundled binary |
| Objective-C | Uncrustify | Bundled binary |
| Haskell | Ormolu | Bundled binary |
- DevToys 2.0 (Preview or later)
- Windows x64 (all formatters are bundled as native binaries)
- Download the
.nupkgfile from Releases - In DevToys, go to Manage Extensions
- Click Install from file and select the
.nupkg - Restart DevToys
- Extract the
.nupkg(it's a ZIP file) to:- Windows:
%LocalAppData%\DevToys\Plugins\CodeFormatter.DevToys.1.0.0\
- Windows:
- Restart DevToys
- Open DevToys and find Code Formatter under the Formatters category
- Select your language from the dropdown
- Paste or type code in the left editor
- Formatted output appears automatically in the right editor
- Swap: Move output to input (useful for re-formatting)
- Clear: Clear both editors
- Settings (gear icon): Configure formatter settings for each language
- Load: Load code from a file
Click the gear icon to open settings for any language. Available options vary by formatter:
- Line Length (40-400)
- Indent Style (space/tab)
- Quote Style (double/single/preserve)
- Line Ending (auto/lf/cr-lf/native)
- Line Width
- Indent Width
- Use Tabs
- Semicolons
- Quote Style
- Line Width
- Indent Width
- Use Tabs
- Trailing Commas
- Uses ANSI SQL standard formatting
- Style (LLVM, Google, Chromium, Mozilla, WebKit, Microsoft, GNU)
- Extra Rules (stricter formatting)
- Indent Width (0 for tabs)
- Binary Next Line
- Case Indent
- Space Redirects
- Keep Padding
- Function Next Line
Settings are saved to ~/.config/code-formatter/config.toml (or equivalent on your OS).
- .NET 8.0 SDK
# Clone the repository
git clone https://github.com/Error0229/cs-f.git
cd cs-f
# Download formatter binaries (from GitHub Release)
curl -L -o formatter-binaries.zip "https://github.com/Error0229/cs-f/releases/download/binaries-v1/formatter-binaries.zip"
unzip formatter-binaries.zip -d Binaries
# Build
dotnet build -c Release
# Run tests
dotnet test
# Create NuGet package
dotnet pack -c Release -o ./nupkgFor development with hot reload:
-
Set environment variables:
[Environment]::SetEnvironmentVariable("DevToysGuiDebugEntryPoint", "C:\path\to\DevToys.exe", "User")
-
Press F5 in Visual Studio/VS Code/Rider to debug with DevToys
The Properties/launchSettings.json is configured for debugging with the EXTRAPLUGIN environment variable.
cs-f/
├── CodeFormatterTool.cs # Main UI and tool implementation
├── Models/
│ ├── Language.cs # Language enum and extensions
│ ├── FormatterConfig.cs # Configuration model
│ └── FormatterSettings.cs # Per-language setting definitions
├── Services/
│ ├── FormatterService.cs # Formatting orchestration
│ ├── ConfigManager.cs # TOML config read/write
│ └── ProcessRunner.cs # External process execution
├── Resources/
│ └── CodeFormatterStrings.resx # Localized strings
├── Binaries/ # Bundled formatter executables (19 binaries)
│ ├── ruff.exe # Python
│ ├── dprint.exe # JS/TS/JSON/Markdown/TOML/CSS/HTML/Vue/Svelte/Astro/YAML/GraphQL/Dockerfile
│ ├── clang-format.exe # C/C++
│ ├── gofumpt.exe # Go
│ ├── shfmt.exe # Shell/Bash
│ ├── google-java-format.exe # Java
│ ├── sqruff.exe # SQL
│ ├── csharpier.exe # C#
│ ├── stylua.exe # Lua
│ ├── air.exe # R
│ ├── pasfmt.exe # Delphi/Pascal
│ ├── ktlint.exe # Kotlin
│ ├── perltidy.exe # Perl
│ ├── php-cs-fixer.exe # PHP
│ ├── mh_style.exe # MATLAB
│ ├── rufo.exe # Ruby
│ ├── asmfmt.exe # Go Assembly
│ ├── uncrustify.exe # Objective-C
│ └── ormolu.exe # Haskell
└── CodeFormatter.Tests/ # Integration tests
MIT
- DevToys - The extensible developer toolbox
- Ruff - Fast Python formatter
- dprint - Pluggable code formatter
- clang-format - LLVM C/C++ formatter
- gofumpt - Stricter gofmt for Go
- shfmt - Shell script formatter
- google-java-format - Java formatter with GraalVM native binary
- sqruff - Native Rust SQL linter and formatter
- CSharpier - Opinionated C# formatter
- StyLua - Lua code formatter
- air - R formatter by Posit
- pasfmt - Delphi/Pascal formatter
- ktlint - Kotlin linter and formatter
- Perl::Tidy - Perl code beautifier
- PHP-CS-Fixer - PHP coding standards fixer
- MH Style - MATLAB formatter
- Rufo - Ruby formatter
- asmfmt - Go assembly formatter
- Uncrustify - Code beautifier for C-style languages
- Ormolu - Haskell formatter