Repository navigation
Expand file tree
/
Copy pathyadf.ini
More file actions
389 lines (325 loc) · 22.8 KB
/
Copy pathyadf.ini
File metadata and controls
389 lines (325 loc) · 22.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126<
8000
/div>
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
; YADF -- Yet Another Delphi Formatter -- configuration file
;
; Without --ini, YADF reads the F profile mapped in %APPDATA%\YADF\profiles.ini
; (by default %APPDATA%\YADF\yadf.ini; manage profiles in YADFSetup or the IDE
; options page). To use a specific INI file, pass
;
; yadf <input> --ini <path-to-other.ini>
;
; on the command line, or --no-ini to read no INI at all (compiled-in defaults
; plus CLI flags; --ini and --no-ini cannot be combined). CLI flags override
; INI values; INI values override YADF's compiled-in defaults.
;
; Every option is listed below with its compiled-in default and a short
; description. Boolean values are case-insensitive (true/false, 1/0, yes/no).
[Format]
; ===================================================================
; Line layout
; ===================================================================
; MaxLen
; Hard cap on emitted line length, in characters. Lines containing
; string literals or // line-comments may extend past this without
; being broken (those exceptions are by design -- breaking inside a
; literal would change behavior).
MaxLen=180
; Indent
; Number of spaces per indent level. Standard Delphi style is 2.
Indent=2
; TabWidth
; How many spaces a leading TAB character expands to when YADF
; normalizes leading whitespace. Tabs inside strings and comments
; are preserved verbatim.
TabWidth=4
; MaxBlankLines
; Cap on consecutive blank lines anywhere in the output. The blank-
; line floor options below (BlanksBeforeSection/Method/Type) win
; over this cap when they ask for more blanks than this allows.
MaxBlankLines=1
; ReflowLines
; When true, a statement broken by hand is joined when it fits MaxLen
; and a longer one is wrapped (see BreakLongExpressions). When false,
; the author's line breaks inside statements are kept and long lines
; are left as-is (still re-indented/aligned); every other construct
; still follows its own option.
ReflowLines=true
; ===================================================================
; Uses clauses (uses, contains, requires)
; ===================================================================
; UsesAlwaysBreak
; When true (default), every uses-style clause is rendered
; one identifier per line, comma-first, with the closing
; semicolon on its own line; the commas and the semicolon are
; indented one step, at the column of the unit names:
;
; uses
; System.SysUtils
; , System.Classes
; ;
;
; When false, the clause stays on a single line if it fits in
; MaxLen and contains no `in 'path'` items; otherwise it breaks
; (and the closing semicolon still goes on its own line).
UsesAlwaysBreak=true
; UsesCommaLast
; Style of the BROKEN (multi-line) uses clause. Only affects the
; broken form; the inline single-line form is unchanged.
; false (default) -- comma-FIRST true -- comma-LAST
; uses uses
; System.SysUtils System.SysUtils,
; , System.Classes System.Classes;
; ;
; Comma-first (default) keeps diffs clean when units are added or
; removed (each line is a complete row including its comma).
; Also sets the separator side of a parameter list broken by
; BreakParamsOnePerLine.
; It does NOT govern the comma-first lists produced by
; BreakLongExpressions (long bracketed lists such as array
; constants); those are always comma-first, so one file can hold
; both styles.
UsesCommaLast=false
; ===================================================================
; Block-end labels and unclosed-block markers
; ===================================================================
; LabelLongBlocks
; When true, long begin/record/case/try/asm/object blocks get a
; trailing `// while`, `// procedure`, etc. comment so the closing
; `end;` is self-describing. When false, existing labels are kept as
; written (nothing is added or removed).
LabelLongBlocks=true
; LabelMinLines
; Minimum block size, in output lines, before LabelLongBlocks adds
; a trailing label.
LabelMinLines=15
; MarkUnclosed
; When true, force-closed openers (a `begin` with no matching
; `end`, etc.) emit a `// TODO -oYADF : '<keyword>' on line N has
; no matching 'end'` marker so they show up in the IDE's To-Do list.
MarkUnclosed=false
; ===================================================================
; Whitespace
; ===================================================================
; TrimTrailing
; Strip trailing whitespace from every emitted line. Strongly
; recommended on; turning it off is mostly for diff debugging.
TrimTrailing=true
; ===================================================================
; Capitalization
; ===================================================================
; LowercaseKeywords
; Lowercase reserved keywords (begin, end, if, else, var, ...).
LowercaseKeywords=true
; UpperHexNumbers
; Uppercase hex digits in $NN literals and the exponent letter
; in floats: $FF, 1E5.
UpperHexNumbers=true
; UpperDirectives
; Uppercase compiler-directive names: {$IFDEF}, {$DEFINE}, ...
UpperDirectives=true
; FirstOccCasing
; Normalize identifier casing to the first occurrence in the
; file. Pascal is case-insensitive, so this is semantically safe.
FirstOccCasing=true
; ===================================================================
; Blank-line floor (insert before a section, never after)
; Defaults are 0; floor wins over MaxBlankLines.
; ===================================================================
; BlanksBeforeSection
; Minimum blank lines before each `interface` / `implementation` /
; `initialization` / `finalization` keyword.
BlanksBeforeSection=0
; BlanksBeforeMethod
; Minimum blank lines before each top-level procedure / function /
; constructor / destructor declaration.
BlanksBeforeMethod=0
; BlanksBeforeType
; Minimum blank lines before each `type` keyword.
BlanksBeforeType=0
; ===================================================================
; Assignment-operator spacing
; ===================================================================
; AssignNoSpaceBefore
; When true, no space before `:=` (e.g. `X:= 1`).
; When false, kept as written (no space is added or removed).
AssignNoSpaceBefore=true
; AssignSpaceAfter
; When true, exactly one space after `:=`. When false, kept as written.
AssignSpaceAfter=true
; ===================================================================
; Pass-2 column alignment
; ===================================================================
; AlignConstEquals
; Align `=` in adjacent `const NAME = VALUE;` lines.
AlignConstEquals=true
; AlignTypeColon
; Align `:` in adjacent declaration lines (var/field/parameter).
AlignTypeColon=true
; AlignDeclSemicolons
; After AlignTypeColon, align the trailing `;` on adjacent declaration
; lines so the semicolons line up in a column too. Set this AND
; AlignTypeColon to false for plain `Name: Type;` declarations.
; Typed constants and initialised variables (`Box: TRect = (...);`,
; `X: Integer = 0;`) are never padded: their value widths differ.
AlignDeclSemicolons=true
; AlignSmartAssign
; When adjacent assignment lines share the same token shape (same
; sequence of operators/punctuation, identifier names may differ),
; pad every common anchor (`:=`, `(`, `,`, `)`, `;`) to its
; max column so they line up. A member `.` (`A.B`) is an anchor
; like the others: padded only when every line of the run has it.
AlignSmartAssign=true
; AlignMaxColumn
; Skip Pass-2 alignment for any anchor that would push a line past
; this column (prevents one outlier from forcing huge padding on
; every neighbor). Also caps the shared column used by
; AlignMatchingShapes and by trailing-comment alignment. Wide
; tables (e.g. long record-constant arrays) align out of the box at
; the default below; very wide ones may still need it raised -- if
; any anchor would cross this column the whole run is left
; untouched. Raised from 100 to 140 (2026-05-17) so AlignMatchingShapes
; aligns typical record-constant tables without a per-project bump.
AlignMaxColumn=140
; AlignMatchingShapes
; Generalises AlignSmartAssign beyond `:=` lines. When two or more
; ADJACENT lines share an identical structural skeleton (same
; sequence of operators/punctuation in the same order -- identifier
; names, strings, and numbers are ignored), every shared anchor is
; padded to a common column so the lines form a neat table. Applies
; anywhere -- record-constant arrays, declarations, repeated calls
; -- not just constant definitions. Lines whose skeletons differ
; are never touched. A member `.` (`A.B`) is an ordinary anchor:
; padded only when every line of the run has it, so `Eta .Th:= 3;` /
; `Omega.Th:= 4;` line up but `A.B:= 1;` / `C:= 2;` do not.
; Set false to keep the old `:=`/const-only behaviour.
AlignMatchingShapes=true
; AlignShapeMinAnchors
; Floor on how many structural anchors a non-`:=` run's shared
; skeleton must have before AlignMatchingShapes will align it. This
; stops trivial 1-2 symbol shapes (e.g. every `Foo(x);` or `a.b;`)
; from triggering noisy column padding across ordinary code. Lines
; that already contain `:=` are unaffected by this floor, with one
; exception: at 2 or less a closing `]` / `)` of the `:=` target is an
; anchor too, so `A[1 ]:= 1;` lines up with `A[333]:= 3;` (at 3 or more
; only the `:=` lines up: `A[1] := 1;`).
AlignShapeMinAnchors=3
; AlignCommentMaxShift
; In a shape-matched run where EVERY line carries a trailing `//`
; comment, pull those comments to one shared column -- but only
; when no line has to move more than this many spaces to get
; there. Comments further apart than this are left where the
; author put them (avoids tearing a ragged gap across the block).
; The shared comment column is still bounded by AlignMaxColumn.
; Set 0 to disable trailing-comment alignment entirely.
AlignCommentMaxShift=7
; ===================================================================
; Output / backup destinations
; ===================================================================
; ResultDir
; When non-empty, every formatted file is written to
; <ResultDir>\<basename-of-source>
; and the source file is left untouched. Leave empty (the default)
; for in-place formatting.
; CLI equivalents: --of <folder> sets, --no-o clears.
ResultDir=
; Backup
; Backups are OPT-IN. With Backup=false (default), in-place formatting
; overwrites the source with no copy of the original. Set Backup=true
; (or pass --b on the command line) to write a backup before the
; in-place edit. Irrelevant when ResultDir is set.
; The same switch governs the preview sample: when a newer YADF
; replaces an edited %APPDATA%\YADF\Sample.pas, the old copy is kept as
; Sample.pas.bak only with Backup=true (one generation).
Backup=false
; BackupDir
; Used only when Backup=true and ResultDir is empty.
; - Non-empty: write a timestamped <name>.<hhhhhhhh>.<YYYYMMDD-hhmmss>.bak
; under this folder before overwriting the source. The hex digits
; identify the source folder, so same-named files from different
; folders never share (or prune) each other's backups.
; - Empty (default): write <source>.BCK<N> next to the source,
; where N is one above the highest existing number (a freed lower
; number is never reused, so the numbers stay in age order).
; CLI equivalent: --b <folder> (with arg) or --b (no arg, sibling).
BackupDir=
; Backups to keep per file (used when backup is on). After a run writes a backup, older YADF backups of that same file beyond the newest N are deleted. 0 = keep all. Default: 0
BackupKeep = 0
; ===================================================================
; File encoding
; ===================================================================
; Encoding
; Controls the byte-level encoding YADF uses when reading and
; writing source files.
; ANSI (default) -- KEEP each file's own encoding: a file
; with a BOM keeps it, a BOM-less file
; detected as UTF-8 stays UTF-8, anything
; else stays ANSI. Nothing is converted.
; UTF-8-BOM -- convert to UTF-8 with the BOM (EF BB BF)
; UTF-16-BOM -- convert to UTF-16 LE with the BOM (FF FE)
;
; The input's encoding (BOM, or BOM-less UTF-8) is always detected on
; load. Only UTF-8-BOM / UTF-16-BOM change the bytes written; the
; default ANSI means "preserve", not "write plain ANSI".
;
; Accepted aliases (case-insensitive):
; ANSI
; UTF-8 | UTF8 | UTF-8-BOM | UTF8BOM
; UTF-16 | UTF16 | UTF-16-BOM | UTF16BOM | UTF-16-LE
Encoding=ANSI
; ===================================================================
; Diagnostics
; ===================================================================
; Logging
; When true, YADF appends to `%APPDATA%\YADF\yadf-startup.log`
; (beside yadf.ini, never beside the exe), capturing the command-line received, the resolved INI path,
; the active option values, and the per-file output decision
; (in-place / result-dir / unchanged). Also emits the same lines
; via OutputDebugString, which CodeSite Live Viewer (or
; Sysinternals DebugView) can capture in real time.
;
; Useful for diagnosing why YADF wrote where it wrote when called
; from an IDE Tool or a build script. Off by default.
; CLI: `--log` to enable, `--no-log` to disable.
Logging=false
; ===================================================================
; Fixed rules (not options)
; ===================================================================
; Tight parens/brackets, single interior spaces and spacing around
; commas, semicolons and colons are fixed rules, always applied.
; Operator spacing follows SpaceAroundOperators. See the help page
; rules-always-on.
; ===================================================================
; Newer options -- listed so this file names EVERY option. The test
; suite pins this ini, and with these keys absent it ran on compiled
; defaults instead (review 2026-10-14). Values = the shipped defaults.
; ===================================================================
; Put one space around binary operators (A+B -> A + B): + - * / = <= >= <>. Unary +/- and generic brackets (<, >) are left intact. Default: true
SpaceAroundOperators = true
; Split "I, J: integer;" into one line per name so the type colons align. Default: true
SplitMultiVarDecls = true
; Re-indent comment-only lines to the surrounding code depth. When off, every comment keeps the indentation the author gave it. A comment line that starts with "//." always keeps its authored indentation even when this is on (an explicit "pin this comment" marker). Default: true
IndentComments = true
; ON (default): when a line exceeds MaxLen, break it at every top-level operator -- one component per line, with the connecting operator LEADING each line ("and X" / "or Y"). A parenthesised group is one component and stays whole; a component that still does not fit is broken the same way, one indent step deeper. A trailing "then" or "do" moves to its own line at the column of the "if" / "while" that introduced it. A line that already fits is never broken. A statement written across lines with an operator (or a lone then / do) leading a line is joined when the WHOLE statement fits MaxLen; those breaks are kept only when it does not fit. A bracketed list that does not fit (a typed-constant array, an argument list) is laid out comma-first: the "(" ends the header line, one whole top-level item per line with the "," leading, the closing ")" on its own line; an item that still does not fit is broken the same way one level down, so an array of records breaks between records, never inside one that fits. A list that fits is joined onto one line. OFF reverts to the greedy breaker, which packs as many components (and list items, comma-last) per line as fit. Default: true
BreakLongExpressions = true
; Break a multi-label case arm ("a, b, c: Stmt;") into one label per line, duplicating the statement. Off by default -- multi-label case arms are kept on one line, and one the author broke across lines ("7," / "8: X;") is joined when it fits MaxLen (only genuine variable/field declarations are split, per SplitMultiVarDecls). Default: false
BreakCaseLabels = false
; Case arm layout. On: a case arm whose body is ONE short simple statement sits on its label line ("0: DoZero;" -- joined when the author broke it and it fits MaxLen); the case else part follows the same rule ("else DoOther;"). Off: the statement goes on its own line, indented under the label ("0:" / " DoZero;", "else" / " DoOther;"). Arms whose body is begin..end, case, try, asm or repeat, an else part of several statements and record variant parts are never touched; a // comment on the label line keeps the arm broken. Pack short bodies (PackShortBodies = true) is a preset that turns this On; an explicit CaseArmOnLabelLine key in the same file is kept. Default: true
CaseArmOnLabelLine = true
; Where `begin` goes, two-way. On: begin joins the line of the then / do / else, the case label or the case else that opens its block ("if X then begin", "while X do begin", "9: begin", "else begin"), and an `end` / `else` / `begin` sequence becomes "end else begin" -- joined when it fits MaxLen. Off: begin goes on its own line at the column of its header ("if X then" / "begin"), and "end else begin" is laid out as "end" / "else" / "begin" on three lines. A // comment after then / do / else / the label keeps begin on its own line; a // comment after begin moves with it. A block that CollapseShortBlocks folds onto one line is not affected. Applies with ReflowLines on or off. Default: false
BeginOnHeaderLine = false
; Fold a short control-statement begin..end body onto one line when it fits MaxLen: an if/for/while/with/else header, a case arm label ("9: begin") or the case else, whose block holds only simple one-statement-per-line code becomes "if X then begin A := 1; B := 2; end;". Only pure simple-statement bodies fold -- a nested block, a multi-line statement, or any comment leaves the block expanded; routine bodies are never folded. Off by default: OFF actively EXPANDS such blocks -- a control block written on one line (or half-broken) gets one statement per line and `end` on its own line, `begin` placed per BeginOnHeaderLine; a block holding a comment, a {$...} directive, asm or a multi-line string is left as written. Default: false
CollapseShortBlocks = false
; Several statements on one line, two-way. On: adjacent plain statements (assignments, calls -- no block keyword, no label, no comment) written on consecutive lines at the same depth are packed onto one line while it fits MaxLen ("A := 1;" / "B := 2;" -> "A := 1; B := 2;"). Off: one statement per line ("A := 1; B := 2;" -> two lines). Fixed rule either way: block keywords start a line and a block body never stays on its header line -- a routine begin, repeat / until, try / finally / except, case ... of and its arms, a record or class body and its visibility sections, and every end; only CollapseShortBlocks may fold a short begin..end. Two declarations on one line ("A: Integer; B: string;") are always split one per line. A line holding a comment or a {$...} directive is left as written. Applies with ReflowLines on or off. Default: false
PackStatements = false
; Loop body layout, two-way. On: the body of a for/while loop goes on its own indented line ("while X do Dec(K);" -> "while X do" / " Dec(K);"). Off: a short simple body is joined onto the do line when the whole fits MaxLen ("while X do" / " Dec(K);" -> "while X do Dec(K);"). A begin block, a nested control header, a header that spans several lines, or a line with a // comment is left alone. Applies with ReflowLines on or off. Default: true
BreakLoopBody = true
; with body layout, two-way: same rules as BreakLoopBody for "with ... do". On: body on its own indented line. Off: a short simple body joined onto the do line when it fits MaxLen. Default: true
BreakWithBody = true
; if body layout, two-way. On: the then/else bodies go on their own indented lines ("if X then A else B;" -> "if X then" / " A" / "else" / " B;"); "else if" chains stay glued; a { } comment right after then stays on the then line. Off: the whole if statement goes on ONE line when every body is one simple statement and it fits MaxLen ("if X then A else B;"), otherwise every body on its own line. The case else part belongs to CaseArmOnLabelLine, not to this option. Pack short bodies (PackShortBodies, below) is a preset that sets BreakIfBody, BreakLoopBody and BreakWithBody to false; an explicit key in the same file is kept. Default: true
BreakIfBody = true
; Pack short bodies onto their header line. A preset over four independent rules: BreakIfBody = false, BreakLoopBody = false, BreakWithBody = false, CaseArmOnLabelLine = true (short if/loop/with bodies are joined onto their header line when they fit; a one-statement case arm goes on its label line). Each of the four stays its own key: a key you set in this file is kept over the preset (order of keys does not matter), and the CLI switches
3DE8
--break-if/--break-loop/--break-with/--case-arm-on-label (and their --no- forms) are kept over a CLI --pack-bodies. A CLI --pack-bodies beats the INI values; --no-pack-bodies cancels the preset only for rules this file does not set; an INI saved by YADF names all four, so they keep their saved values (use the --break-* switches). Default: false
PackShortBodies = false
; Lay out a routine declaration with one parameter per line ("procedure Go(const A: string; B: Integer);" -> one parameter per line). Fires on named routine declarations with 2 or more parameters; a grouped declaration ("const A, B: string") is split into one name per line, repeating the modifier. Separator placement follows UsesCommaLast. A group carrying an attribute, an interior comment, or an "=" default value is kept whole. Call-site argument lists are never touched. Off by default. Always on while JoinRoutineHeaders = false (that option implies this one). Default: false
BreakParamsOnePerLine = false
; Join a routine header the author split across lines back onto one line (wrapping it after a ';' or ',' at MaxLen). On (default) = today's behaviour. Off = the opposite layout: one parameter per line, exactly as BreakParamsOnePerLine = true -- Off IMPLIES BreakParamsOnePerLine (the Options page shows that box checked and disabled while this one is unchecked). Independent of ReflowLines. Default: true
JoinRoutineHeaders = true
; Hoist inline var declarations into a top-of-routine var block so the code builds on Delphi 10.2.3. Explicit types and simple literals are converted; the rest stay in place with a "// TODO -oYADF -cd10 :" flag to resolve by hand. A run with Delphi10Compat = false removes exactly those flags (never another comment). Best-effort, unverified on a real Tokyo toolchain. Default: false
Delphi10Compat = false