The formatter does not handle the multi line string literals introduced in Delphi 12:
const
bla = '''
first line
seconde line
indented third line
fourth line even further indented
last line, no longer indented
''';
gets formatted as:
const
bla = '''
first line
seconde line
indented third line
fourth line even further indented
last line, no longer indented
''';
The indentation of the third and fourth line gets removed.
There are possibly even more problems if the string contains semicolon or comma characters or reserved words.
added unit tests in revision #4110
A workaround for now is to enclose these strings with the {(} and {)} comments that prevent formatting. But note that this only works as long as the string content does not contain these special comments itself.
Last edit: Thomas Mueller 2023-11-26
Diff:
fixed in revision #4112
re-opened: Turned out that I overlooked some unit tests that previously worked but are now broken.
Fixed again in revision #4115, let's hope this time for real.