taplo

A TOML toolkit — formatter, linter, and language server — that brings first-class editor support and CI enforcement to your TOML files.

taplo is a TOML toolkit that provides a formatter, linter, language server (LSP), and schema validator all in one. If you work with Rust projects, you're already surrounded by TOML — Cargo.toml, config.toml, .cargo/config.toml — and taplo makes working with all of it much more pleasant.

Features

  • Formatter — opinionated, consistent TOML formatting with configurable options; integrates into editors and CI pipelines
  • Linter — catches semantic errors like duplicate keys, type mismatches against a schema, and invalid values
  • Language server (LSP) — provides completions, hover documentation, go-to-definition, and inline diagnostics in any LSP-compatible editor
  • Schema validation — validates TOML files against JSON Schema definitions; ships with built-in schemas for Cargo.toml, pyproject.toml, and many more
  • Schema catalog — integrates with SchemaStore to automatically detect and apply the right schema based on filename
  • CI-friendlytaplo fmt --check exits non-zero if any files are unformatted, making it easy to enforce style in CI

Installation

cargo install taplo-cli --locked

Or via package manager:

# Debian / Ubuntu (Debian 13+)
apt install taplo

# Fedora
dnf install taplo

# macOS
brew install taplo

# Arch Linux
pacman -S taplo

# Nix
nix-env -iA nixpkgs.taplo

Usage

# Format a TOML file in-place
taplo fmt Cargo.toml

# Format all TOML files in the current directory tree
taplo fmt

# Check formatting without modifying files (for CI)
taplo fmt --check

# Lint a file and show diagnostics
taplo lint Cargo.toml

# Validate against a schema
taplo lint --schema https://json.schemastore.org/cargo.json Cargo.toml

# Start the language server (used by editor integrations)
taplo lsp stdio

Editor Integration

Since taplo implements the Language Server Protocol, it works with any LSP-compatible editor:

  • VS Code — install the Even Better TOML extension
  • Neovim — available via nvim-lspconfig as taplo
  • Helix — built-in support; taplo is auto-detected for .toml files
  • Zed — available as an extension

Configuration

Taplo reads formatting options from a .taplo.toml (or taplo.toml) file:

[formatting]
align_entries        = false
align_comments       = true
array_trailing_comma = true
array_auto_expand    = true
column_width         = 80
indent_string        = "  "

You can also configure it per-file using an .editorconfig-style approach, or inline with special comments.

CI Example

Add a formatting check step to your GitHub Actions workflow:

- name: Check TOML formatting
  run: |
    cargo install taplo-cli --locked
    taplo fmt --check