YADF options
YADF (Yet Another Delphi Formatter) is configured with the options below. The same list appears in YADFSetup and on the Delphi Tools > Options page, and is stored in the INI file of the active profile.
Line length & indentation
- Max line length
Maximum line length in columns. Long lines are reflowed when "Reflow long lines" is on.
- Indent step
Indentation step in spaces (each nesting level adds this many).
- Tab width
Width assumed for an existing tab on input. YADF always emits spaces.
Reflow & whitespace
- Reflow long lines
Reflow lines that exceed the max line length. Off = long lines are left as-is.
- Trim trailing spaces
Trim trailing whitespace from every output line.
- Max blank lines
Maximum consecutive blank lines kept in output. Excess blanks are collapsed.
- Blanks before section
Blank lines forced before each interface section. 0 = no change.
- Blanks before method
Blank lines forced before each method body.
- Blanks before type
Blank lines forced before each top-level type declaration.
- Pack short bodies & case arms
Pull a short loop/if body or case arm onto one line when reflowing. Off by default.
- Collapse short begin..end blocks
Fold a short begin..end body of if/for/while/with onto one line when it fits. Off by default.
- Break loop body onto its own line
Put the body of a single-line for/while loop on its own indented line. Off by default.
- Break with body onto its own line
Put the body of a single-line with..do on its own indented line. Off by default.
- Break if/then/else body onto its own line
Put the then/else body of a single-line if on its own indented line. Off by default.
- Smart expression breakup
When a line exceeds the max length, break it at every top-level operator, one component per line. Off = greedy packing.
Casing
- Lowercase keywords
Lowercase Pascal keywords (begin, end, if, then ...).
- Uppercase hex
Uppercase hex digits in numeric literals ($AB not $ab).
- Uppercase directives
Uppercase compiler-directive keywords ({$IFDEF}, {$R+} ...).
- First-occurrence casing
Cascade casing from the first occurrence of each identifier to all later uses.
Assignment & alignment
- No space before :=
No space BEFORE := ("X:= 1" not "X := 1").
- Space after :=
Single space AFTER := ("X:= 1" not "X:=1").
- Align const =
Vertical-align = in const blocks.
- Align type :
Vertical-align : in type / var / parameter blocks.
- Smart-align
Master switch for shape-aware alignment of := runs and, with "Align matching shapes", other matching shapes.
- Align max column
Maximum column an alignment may push to. Past this, alignment is skipped.
- Align matching shapes
Align matching "shapes" (record-init lines, repeated field declarations).
- Shape min anchors
Minimum anchors required before shape-alignment kicks in.
- Comment max shift
Maximum columns a trailing comment may shift when aligning to a shape.
Spacing
- Space around operators
One space around binary operators (A+B -> A + B). Unary signs and generic brackets are left alone.
Uses clauses
- Break uses one-per-line
Always break uses clauses one unit per line.
- Comma-last uses layout
Broken uses clause style: off = comma-first (diff-friendly), on = comma-last.
Declarations
- Split multi-var decls
Split "I, J: integer;" into one line per name so the type colons align.
- Align decl semicolons
Align the trailing ; of consecutive declaration lines (after "Align type :").
- Break case labels
Break a multi-label case arm ("a, b, c: Stmt;") into one label per line. Off by default.
- Break parameters one per line
Lay out routine declarations with 2+ parameters one parameter per line. Off by default.
Comments
- Indent comments
Re-indent comment-only lines to the surrounding code depth. A "//." comment keeps its indentation.
Delphi 10 compatibility
- Downgrade inline vars
Hoist inline var declarations into a var block so the code builds on Delphi 10.2.3. Best-effort.
Labels & markers
- Label long blocks
Mark the end of long blocks with the block keyword: "end; // while".
- Label min lines
Minimum block length in lines before a long block gets an end label.
- Mark unclosed blocks
Add a "// TODO -oYADF" marker where a begin/record/... has no matching end.
File & CLI (no preview effect)
- Backup before overwrite
Create a backup of every file before overwriting it.
- Backup directory
Directory for backups (used when backup is on). Empty = next to the original file.
- Result directory
Directory for formatted output. Empty = format in place.
- Output encoding
ANSI keeps each file's own encoding; UTF-8/UTF-16 convert the output (with BOM).
- Logging
Write a log file with details of every option resolved and file processed.
Profiles & IDE integration
- Profiles (F and R)
Named settings files. F = Ctrl+Shift+Alt+F, R = Ctrl+Shift+Alt+R; assign a profile to a key with Set F / Set R.
- Use YADF as the IDE code formatter
Use YADF for Format Source and format-on-save (Delphi 13.2+, F profile). Needs an IDE restart.