Formatter Options
Go Up to Language Options
Tools > Options > Language > Formatter
Pages in the Formatter group define the formatter options that customize the behavior of the source code formatter. When you select an option, help for the option is displayed in the lower pane of the page.
Contents
Delphi formatting options
Different sets of formatting options are used to format Delphi source code files:
- In pages under Delphi, you can set options to be used in Delphi projects for Delphi source code files with the following extensions:
*.pas
,*.dpr
,*.dpk
,*.dpkw
,*.inc
.
- Delphi contains the Indentation, Spaces, Line breaks, Capitalization, and Align pages.
Indentation
Indentation options | Description |
---|---|
Continuation indent |
Defines additional indent that is added for continuation lines when an expression is continued on several lines. The default is 2. |
Do not indent after position |
Defines the maximum width of indent, which the formatter can insert. The default is 40. |
Indent assembly sections |
If set to |
Indent Begin and End keywords |
If set to |
Indent blocks between Begin and End |
If set to |
Indent case contents |
If set to |
Indent case labels |
If set to |
Indent class definition bodies |
If set to |
Indent comments |
If set to |
Indent compiler directives |
If set to |
Indent Else in case statements |
If set to |
Indent function bodies |
If set to |
Indent inner functions |
If set to |
Indent interface, implementation, and other sections |
If set to |
Indent labels |
Defines indentation of labels. The default is set to |
Indent nested brackets and parentheses |
If set to |
Spaces
Space options | Description |
---|---|
Resolve space conflicts as |
Defines how to manage spaces in positions that are controlled by several conflicting options. The default is |
Set spacing around assignment operators |
Defines space around assign '=' operators. The default is |
Set spacing around binary operators |
Defines spaces around binary mathematical operators. The default is |
Set spacing around colons |
Defines spaces around colons. The default is |
Set spacing around colons in format |
Defines spaces around colons in format parameters. The default is |
Set spacing around commas |
Defines spaces around colons. The default is |
Set spacing around semicolons |
Defines spaces around semicolons. The default is |
Set spacing around unary prefix operators |
Defines spaces around unary prefix operators. The default is |
Set spacing for // comments |
Defines spaces around the // token in line comments. The default is |
Set spacing for { and (* comments |
If set to |
Indent Else in case statements |
Defines spaces around the opening, closing braces, or in block comments. The default is |
Set spacing for parentheses |
If set to |
Set spacing for square brackets |
If set to |
Set spacing inside angle bracket in generics |
Defines inner spacing inside angle brackets used in generics to specify lists of type arguments. The default is |
Space before parenthesis in functions |
Defines spaces before parenthesis in functions and procedures. The default is set to |
Line Break
Indentation options | Description |
---|---|
Keep user line breaks |
If |
Line break after Begin |
Defines whether to insert a line break after each 'begin' keyboard. The default is |
Line break after label |
Defines whether to insert line breaks after labels. The default is |
Line break characters |
Defines characters that will be inserted as line breaks. |
Line break inside 'Else If' |
Defines whether to insert line breaks between 'else' and 'if' in nested 'if' statements. The default is |
Line breaks after Begin in control statements |
Defines whether to insert line breaks after 'begin' in conditional statements and in loop statements. The default is |
Line breaks after Begin in method definitions |
Defines whether to insert line breaks after the 'begin' keyword in method definitions. The default is |
Line breaks after semicolons |
Defines whether to insert a line break after each semicolon. The default is |
Line breaks after Uses keywords |
Defines whether to insert line breaks after Uses, Label, Export, Requires and Contains keywords. The default is |
Line breaks before Begin in control statements |
Defines whether to insert line breaks before 'begin' in conditional statements and in loop statements. The default is |
Line breaks before single instructions ion control statement |
Defines whether to insert line breaks before single instructions in conditional statements and in loop statements. The default is |
Line breaks before single instructions in try-except blocks |
Defines whether to insert line breaks before single instructions in 'try-except' and 'try-finally' blocks. The default is |
Line breaks before Then |
Defines positioning of 'then' keywords in 'if' statements. The default is |
Line breaks in Anonymous Function assignments |
Defines whether to insert line break in assignment with Anonymous Function. The default is |
Line breaks in Anonymous Function usage |
Defines whether to insert line break in Anonymous Function usage. The default is |
Line breaks in array initializations |
Controls line breaks in array initializations. The default is |
Line breaks in Inheritance lists |
Defines positioning of base classes and interfaces in inheritance lists. The default is |
Line breaks in Label, Export, Requires, Contains clauses |
Defines whether to insert line breaks before the element in Label, Export, Requires, Contains clauses. The default is |
Line breaks in Property declarations |
Defines whether to insert line breaks before each 'read', 'write', 'stored', 'default' keyword inside property declarations. The default is |
Line breaks in Uses clauses |
Defines whether to insert line breaks before each element in the Uses clauses. The default is |
Line breaks in Var and Const sections |
Defines whether to insert line breaks before each element in Var and Const sections. The default is |
Max number of adjacent empty lines |
Defines the maximum number of adjacent user-defined empty lines in the code. The default is 1. |
New line for a function return type |
Defines positioning of the return type in a function declaration and definition. The default is |
Number of empty lines around compiler directives |
Defines the number of empty lines used as separators around compiler directives. The default is 0. |
Number of empty lines around section keywords |
Defines the number of empty lines used as separators around 'Interface', 'Implementation', and other keywords that open sections. The default is 1. |
Number of empty lines as separator in the implementation section |
Defines the number of empty lines used as separators in implementation sections. The default is 1. |
Number of empty lines as separator in the interface section |
Defines the number of empty lines used as separators in interface sections. The default is 1. |
Number of empty lines before subsections |
Defines the number of empty lines used as separators before 'Var', 'Const' 'Label', and other subsections. The default is 1. |
Number of empty lines before Type keyword |
Defines the number of empty lines used as separators before 'type' keywords. The default is 1. |
Number of empty lines before visibility modifiers |
Defines the number of empty lines used as separators before visibility modifiers. The default is 0. |
One parameter per line in function calls |
Defines positioning of parameter values in function/procedure calls. The default is |
One parameter per line in function definitions |
Defines positioning of parameters in function and procedure declarations and definitions. The default is |
Remove line breaks inside 'End Else Begin' |
Defines whether to remove line breaks inside 'End Else Begin' constructions. The default is |
Remove line breaks inside 'End Else If' |
Defines whether to remove line breaks inside 'End Else If' constructions. The default is |
Right margin |
Defines the right margin to split code lines. The default is 80. |
Trim source |
Controls removing white spaces (spaces, tabs, and line breaks) from the beginning and end of the file. The default is |
Capitalization
Indentation options | Description |
---|---|
Capitalization of compiler directives |
Defines capitalization of compiler directives. The default is |
Capitalization of numbers |
Defines capitalization of letters uses in hexadecimal and float numbers, including characters in prefixes and suffixes. The default is |
Capitalization of other words |
Defines how to capitalize words that do not belong. The default is |
Capitalization of reserved words and directives |
Defines capitalization of reserved words and directives. The default is |
Align
Indentation options | Description |
---|---|
Align ":" before type names |
Defines whether to align colons before type names. The default is |
Align "=" in constants |
Align assigment operators in constant initializations. The default is |
Align "=" in initializations |
Align assigment operators in initializations . The default is |
Align "=" in type declarations |
Align "=" in type declarations. The default is |
Align assignment operators |
Align assigment operators. The default is |
Align end-of-line comments |
Align comments located at the ends of lines. The default is |
Align fields in properties |
Align fields and methods in properties. The default is |
Align type names |
Align type names in var sections and records. The default is |
Align types of parameters |
Align types of parameters. The default is |
Alignment maximum column |
Do not insert alignment blank spaces after the specified column. The default is 60. |
Maximum unaligned lines |
The maximum number of consistent unaligned lines of code allowed without ending one alignment block of lines. The default is |
Profiles and Status page
In the Profiles and Status page, you can manage sets of formatter options, enable the source code formatter, and enable the Confirmation prompting message before the formatting commands.
Managing sets of Formatter options
The source code formatter has several predefined sets of formatting options. You can select the active set with Select profile. Then the set of formatting options stored in the selected formatter profile (configuration file) becomes the currently used set of options for the formatter.
You can customize the active set of options and save it in a formatter configuration file using Save As. Later you can load the set of options (stored in a configuration file) using Load.
Managing Formatter's behavior
Options in the Formatter Status group define the formatter behavior:
- Enable Formatter -- Select this option to enable the formatter. If this option is unselected, then all menu commands responsible for the formatting of source code files become hidden and inaccessible.
- Show Confirmation dialog box -- When selected, the Confirmation prompting message appears each time you try to activate any formatting command.
Editor options used by Formatter
The source code formatter uses the Use tab character
, Block indent
, and Tab stops
options
that are defined in the Source Options page (Editor Options > Source Options) of the Options dialog box.
- To set these options for Delphi, select
Pascal
in Source file type. - To set these options for C++, select
C/C++
in Source file type.