IDE plugin + CLI · Delphi 10.3 Rio → 13 Florence

Format your Delphi code.
Lose nothing.

radFormatter is a non-destructive Delphi source code formatter for the RAD Studio IDE and the command line. It parses your source into a full syntax tree, decides spacing, line breaks, indentation, and alignment from real structure — and validates that nothing beyond whitespace and casing ever changes. If it would, your original file is returned untouched.

.pas.dpr.dpk.dpkw.inc

unit Demo;
interface
uses System.SysUtils, System.Classes;
implementation
procedure Test(A, B: Integer);
begin
  IF A>0 THEN DoIt(A);
  B:=A*2+1;
end;
end.

// Mixed casing, tight spacing, no blank lines. Pick a profile.

It can't eat your code

Every format is verified before it is accepted. If anything beyond whitespace or casing would change, the result is discarded and your original source comes back untouched. And your source never leaves your machine: radFormatter runs fully offline — no telemetry, no license phone-home, no network access at all.

Content-hash validation

A whitespace-excluded hash of the source is compared before and after formatting. Any mismatch discards the change.

Token fingerprinting

The output is re-lexed and its token fingerprint compared to the original. Same tokens in, same tokens out — or no change at all.

Graceful failure & backups

When validation fails, the original source is returned unchanged. Add -b to write a .bak copy before any overwrite.

In your IDE, or in your pipeline

Press Ctrl+D in RAD Studio to format the current unit — or just a selection. The plugin's split-screen config editor previews every option live against your own source, and it writes the same radFormatter.json the CLI uses, so the editor, the command line, and CI all format identically. One installer covers every IDE from Delphi 10.3 Rio through 13 Florence.

The radFormatter split-screen configuration editor showing option tabs and a live before/after source preview

Explore the IDE plugin →

Built on real parse data

radFormatter tokenizes your source and builds a full Concrete Syntax Tree, then runs an owned-decision pipeline: each stage writes exactly one part of the output, and no stage can undo another’s work.

From your source to settled decisions — in this order

Source CST Casing & spacing Line breaks Indent Alignment Right margin Render & validate
CST-aware

Structure, not heuristics

Indentation, case structure, generic parameters, and nested control flow are driven by the parse tree, not line-based guesswork.

Owned decisions

One writer per decision

Every physical part of the emitted file has exactly one owner — line breaks, leading whitespace, interior padding. Decisions settle once, so stages never fight over the same character.

Profiles and configuration

A profile is a named starting point. Whatever you pass with -config is overlaid on top, so you only specify what you want to change — from “touch nothing” to the full Embarcadero style guide. Underneath are 57 options across seven sections, all in one radFormatter.json. Commit it and every developer and CI job formats identically.

The seven option sections — click any to browse its reference

ProfileIntent
Default Conservative: reindents and applies case structure, but preserves spacing, casing, and user line breaks. The safest starting point.
FormatterExe Approximates RAD Studio’s built-in Formatter.exe — active spacing, blank lines around sections, an 80-column right margin.
Embarcadero The official Embarcadero Delphi style guide: lowercase keywords, one uses entry per line, one statement per line, 160-column margin.
NoOp Pass-through: output matches input byte-for-byte (modulo line endings). The least invasive way to adopt the formatter one rule at a time.

Browse all 57 options → See all four profiles on the same input →

A CLI that fits your workflow

Format a file to stdout, rewrite a whole tree in place, or gate a pull request — with the same config everywhere.

Everyday use

# Format one file to stdout (source untouched)
> radFormatter source/MyUnit.pas

# Format a whole tree in place, with backups
> radFormatter -d source -r -w -b

# Generate a starter configuration
> radFormatter -writeDefaultConfig radFormatter.json

In CI

# Fail the build if any file needs formatting
> radFormatter -check -config radFormatter.json -d source -r

# GitHub Actions
- name: Check formatting
  run: radFormatter -check -config radFormatter.json -d source -r

Settle formatting disputes once: commit radFormatter.json to your repository and every developer and CI job uses the same configuration. Full CLI reference →