CodeFormatter.DevToys 1.1.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package CodeFormatter.DevToys --version 1.1.2
                    
NuGet\Install-Package CodeFormatter.DevToys -Version 1.1.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CodeFormatter.DevToys" Version="1.1.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CodeFormatter.DevToys" Version="1.1.2" />
                    
Directory.Packages.props
<PackageReference Include="CodeFormatter.DevToys" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CodeFormatter.DevToys --version 1.1.2
                    
#r "nuget: CodeFormatter.DevToys, 1.1.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CodeFormatter.DevToys@1.1.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CodeFormatter.DevToys&version=1.1.2
                    
Install as a Cake Addin
#tool nuget:?package=CodeFormatter.DevToys&version=1.1.2
                    
Install as a Cake Tool

Code Formatter for DevToys

A code formatting extension for DevToys 2.0 that supports 22 programming languages with automatic live formatting.

Features

  • Live Auto-Format: Code is automatically formatted as you type (500ms debounce)
  • 22 Languages: Python, JavaScript, TypeScript, JSON, Markdown, TOML, CSS, SCSS, Less, HTML, Vue, Svelte, Astro, YAML, GraphQL, Dockerfile, Java, SQL, C, C++, Go, Shell/Bash
  • 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

Supported Languages & Formatters

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 Prettier + prettier-plugin-java Requires Node.js
SQL sql-formatter Requires Node.js
C clang-format Bundled binary
C++ clang-format Bundled binary
Go gofumpt Bundled binary
Shell/Bash shfmt Bundled binary

Requirements

  • DevToys 2.0 (Preview or later)
  • For Java/SQL formatting: Node.js with npm packages:
    npm install -g prettier prettier-plugin-java sql-formatter
    

Installation

From NuGet Package

  1. Download the .nupkg file from Releases
  2. In DevToys, go to Manage Extensions
  3. Click Install from file and select the .nupkg
  4. Restart DevToys

Manual Installation

  1. Extract the .nupkg (it's a ZIP file) to:
    • Windows: %LocalAppData%\DevToys\Plugins\CodeFormatter.DevToys.1.0.0\
    • macOS: ~/Library/com.devtoys/Plugins/CodeFormatter.DevToys.1.0.0/
    • Linux: ~/.local/share/devtoys/Plugins/CodeFormatter.DevToys.1.0.0/
  2. Restart DevToys

Usage

  1. Open DevToys and find Code Formatter under the Formatters category
  2. Select your language from the dropdown
  3. Paste or type code in the left editor
  4. Formatted output appears automatically in the right editor

Buttons

  • 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

Configuration

Click the gear icon to open settings for any language. Available options vary by formatter:

Python (Ruff)

  • Line Length (40-400)
  • Indent Style (space/tab)
  • Quote Style (double/single/preserve)
  • Line Ending (auto/lf/cr-lf/native)

JavaScript/TypeScript (dprint)

  • Line Width
  • Indent Width
  • Use Tabs
  • Semicolons
  • Quote Style

JSON (dprint)

  • Line Width
  • Indent Width
  • Use Tabs
  • Trailing Commas

SQL (sql-formatter)

  • Language dialect (PostgreSQL, MySQL, SQLite, etc.)
  • Tab Width
  • Keyword Case
  • Data Type Case
  • Function Case

C/C++ (clang-format)

  • Style (LLVM, Google, Chromium, Mozilla, WebKit, Microsoft, GNU)

Go (gofumpt)

  • Extra Rules (stricter formatting)

Shell/Bash (shfmt)

  • 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).

Building from Source

Prerequisites

  • .NET 8.0 SDK
  • Node.js (for Java/SQL formatting tests)

Build

# Clone the repository
git clone https://github.com/user/cs-f.git
cd cs-f

# Build
dotnet build -c Release

# Run tests
dotnet test

# Create NuGet package
dotnet pack -c Release -o ./nupkg

Development

For development with hot reload:

  1. Set environment variables:

    [Environment]::SetEnvironmentVariable("DevToysGuiDebugEntryPoint", "C:\path\to\DevToys.exe", "User")
    
  2. 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.

Project Structure

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
│   ├── ruff.exe
│   ├── dprint.exe
│   ├── clang-format.exe
│   ├── gofumpt.exe
│   └── shfmt.exe
└── CodeFormatter.Tests/      # Integration tests

License

MIT

Acknowledgments

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.0 322 12/15/2025
1.1.3 118 12/12/2025
1.1.2 114 12/12/2025
1.1.1 108 12/12/2025
1.1.0 113 12/12/2025
1.0.0 502 12/1/2025