Reputation: 341
I am using Delphi 10.4 Community Edition. I have used this program for a while now without problems, but now the code formatter (Menu -> Project -> Format Project Sources) formats everything correctly, except it doesn't use the common 2 spaces for indentations, but uses 8 spaces.
I didn't change anything. I was coding and formatting a few times and it worked well, but suddenly, while using the code formatter a few times in a project, it started formatting with 8 spaces before everything.
When I use the Ctrl+D keys, it formats normally using 2 spaces only.
Can anyone tell me why Delphi decided to use 8 spaces randomly, and how I can change it back to normal settings?
I tried Menu -> Tools -> Options -> Language -> Formatting -> Delphi -> Indent, and changed "indent at line continuation " to 3, which worked so far, but when I type in 1 or 2, it uses 4 instead of 1 or 2.
Why??
EDIT: Of course, reinstalling Delphi (probably also the whole Windows alongside my Delphi installation) would solve the problem, but I would like to avoid this.
Upvotes: 1
Views: 426
Reputation: 1
This worked for me:
Tools>Options>Language>Formatter>Delphi>Profiles and Status, click Restore Defaults.
Upvotes: 0
Reputation: 237
I am using Delphi 11.2
and this is still not solved.
I select Project -> Format Project Source
and on some files it formats indenting with 2 spaces and in others with 8 spaces.
If I press CTRL+D
then it indents with 2 spaces.
I tryed to set to NO and then to YES de option "Line breaks before single instruction
" but it didn't work.
I couldn't find any information on this bug.
Upvotes: 0
Reputation: 15334
In the Delphi Formatter settings under Line breaks, if you have "Line breaks before single instructions in control statements" set to "No" or "As is", any if statements with just a single instruction formats with too many spaces. If I set it back to "Yes", the formatting works as expected.
Seems to be a bug in the formatter.
Upvotes: 0