All notable changes to pasfmt will be documented in this file.
More detailed changelog files for some of the underlying crates can be found in their respective directories.
The format is based on Keep a Changelog.
0.7.0 - 2025-11-11
- Added formatting for multiline string interior whitespace. Enabled by default with new setting
format_multiline_strings.- Indentation is normalised to align the trailing quote with the leading quote. Lines in the middle are adjusted to retain their original significant leading whitespace.
- Internal line endings are normalised to match the configured line ending.
- Invalid multiline strings are left untouched.
- All keywords are now set to lowercase. This includes reserved words (like
beginandconst) but also includes non-reserved words (likeabsoluteandoverride) when used in the context that makes them special. - Added formatting for the interior of inline comments
- If no whitespace exists after the
//(or///), one space is added.- "separator" lines are exempt, defined as a comment containing only 10 or more repetitions of a non-alphanumeric character.
- Trailing whitespace at the end of the comment is trimmed.
- If no whitespace exists after the
- All compiler directives are now set to uppercase. This includes switch directives (e.g.
{$O+}), parameter directives (e.g.{$HINTS on}), and conditional directives (e.g.{$IFDEF Foo}).
0.6.0 - 2025-08-25
- Fixed indentation of comments around statements outside of statement lists.
- Fixed performance issues with heavily nested conditional directives.
- Fixed formatting of anonymous routines containing subroutines.
- Unterminated string literals will never be merged with other tokens.
- Improved support for multiline strings.
- A break will be inserted before each multiline string to ensure stylistic consistency.
- Surrounding code will be appropriately wrapped.
- String contents currently can not be re-indented. Including the closing quotes.
- Anonymous routines are now wrapped onto multiple lines whenever they contain declaration sections
(e.g.
var,const,type).
0.5.1 - 2025-06-02
- Fixed formatting of
resourcestringsections. - Fixed indentation inside
initialization/finalizationsections.
0.5.0 - 2025-03-31
- Never break in the middle of
reference to functionandreference to procedure. - Improved consistency across procedural types and anonymous routine headers.
- Improved line wrapping layout heuristics for lines that exceed the
wrap_column. - Allow
set ofanonymous enum to be on same line as=.
- Fixed formatting of structures after a label.
- Visibility specifiers (e.g.
private,public) are no longer treated like section headers when used outside type declarations. - Fixed formatting of comments before the first item in import and exports clauses.
- Stopped consuming directive-like declarations following procedural types.
0.4.0 - 2025-03-18
- Uses, contains, and requires clauses in
program,package, andlibraryfiles are no longer ignored. Previously there were concerns over breaking IDE features by formatting these sections, but after some testing and reconsideration we have decided that this is a non-issue and it's better to consistently format all import clauses. - Compiler directives in
packagefiles are now flush with the margin, matching the style in the code generated by RAD Studio.
0.4.0-rc2 - 2025-03-12
- Fixed spacing around generics with composite type parameters (e.g.
array of,set of,string[10]). - Fixed fields being merged with comments in variant records. A safety check has been added to prevent bugs of this kind in the future.
- Fixed end of line comment placement after compiler directives.
- Fixed infinite loop on unterminated parameter list.
- Allow case arm statements to be formatted inline.
- Allow simple conditionally compiled code to be formatted inline.
0.4.0-rc1 - 2025-02-20
- Fixed lexing of conditional directive expressions containing compiler directives, comments, or strings.
- Fixed lexing of compiler directives similar to conditional directives (e.g.
{$if_}). - Fixed lexing of unterminated asm text literals at EOF.
- Fixed lexing of sequential conditionally-compiled asm keywords.
--config-fileno longer erroneously accepts a path to a directory and searches from it for apasfmt.tomlfile. It is now an error to provide a path to a directory.- Fixed detection of decoding errors when reading from stdin.
- Stopped ignoring non-existent paths (they were being treated as globs matching no files).
- Fixed errors when writing non-ASCII data in an ANSI encoding to a Windows Console. Now written as Unicode.
- Changed error message when
--mode=checkfails on stdin, now reads'<stdin>' has incorrect formatting. - Started using simple struct-level debug formatting for logging of the current configuration. Previously it was in TOML format.
- Started wrapping CLI help at the smallest of the terminal width and 120 characters.
- Changed whitespace configuration
line_endingnow controls the end-of-line sequence (previouslyreconstruction.eol). Default "native".use_tabsnow controls the character used for indentation. Default false.tab_widthnow controls the number of spaces per indentation. Default 2.continuation_indentsnow controls the number of indentations per continuation. Default 2.
- Changed indentation level of comments in various edge cases.
- Added line wrapping to reflow all kinds of logical lines.
- Configuration option
wrap_columncontrols the line length. - Configuration option
begin_stylecontrols the location ofbeginin control flow statements.
- Configuration option
- Added cursor tracking, via the
--cursorCLI option.- Expects a comma-separated list of UTF-8 byte offsets into the file. After formatting, a line
with the structure
CURSOR=1,2,3,4is printed to stderr, indicating the new locations of the provided cursors.
- Expects a comma-separated list of UTF-8 byte offsets into the file. After formatting, a line
with the structure
- Added debug logging for time taken to format each file.
- Added name for platform-dependent encoding configuration option, "native". This has the behaviour of the previous implicit default.
- Stopped formatting inline assembly instructions. The lines are ignored.
0.3.0 - 2024-05-29
- Fixed erroneous removal of BOM.
- Fixed erroneous transcoding of UTF-16 input to UTF-8.
- Removed unwanted use of the replacement character when encoding. This now results in an error.
- Renamed
--files-fileparameter to--files-from.
0.2.0 - 2024-05-07
- Fixed incorrect parsing for generic type param lists containing semicolons.
- Removed extra trailing newline when formatting stdin to stdout.
- Fixed lexical edge cases with unusual whitespace.
- Fixed incorrect encoding used for writing files with encodings inferred from a BOM.
- Fixed incorrect encoding used in stdin/stdout mode; UTF-8 was always used, but now the configured encoding is respected.
- Changed handling of unterminated comments and text literals.
- Changed the default encodings
- Windows: system ANSI codepage.
- non-Windows: UTF-8.
- Improved handling of IO errors. Previously any IO error would immediately crash the program. Now errors are logged when they occur and cause the program to exit non-zero after all other files have been formatted successfully.
- Added support for Delphi 12 multi-line string literals.
- Added
-CCLI option to override configuration options. - Added
--modeCLI option which replaces the--writeand--verifyoptions. The default for this option is dynamic; when files to format are provided the default isfiles, otherwise (when formatting stdin) it'sstdout. This differs from the previous default behaviour which was equivalent tostdout.
checkmode replaces--verifywith some differences:- Non-zero exit code in the case of incorrectly formatted files.
- Can be used in stdin/stdout mode.
- Messages for incorrectly formatted files prefixed with 'CHECK' instead of 'VERIFY', and are sent to stderr, not stdout.
- Added validation to the reconstruction settings. This now ensures that indentation, eol, and continuation are all non-empty and only consist of whitespace. Without this validation, the format may not be idempotent.
- Added colour styling in CLI help.
- Removed short version of
--config-fileCLI option. - Removed
--write/-wCLI option (now accessible via--mode=files). - Removed
--verifyCLI option (replaced by--mode=checkwith some differences).
0.1.0 - 2023-08-28
- Format uses clauses.
- Program uses clauses are ignored.
- Remove repeated empty new lines.
- Normalise to a single new line at eof.
- Trim trailing whitespace.
- Parallel reading, formatting, and writing of files.
- Command-line interface.
- Support a special comment syntax to disable formatting
// pasfmt off Foo ( ); // pasfmt on
- Format spaces between all tokens (on separate lines)