This section describes some of the features and options that are available for Ada, including language-specific options and the Ada Beautifier.
An option to set keyword casing is available for Ada. To access it, from the main menu, click Window → SlickEdit Preferences → Languages, expand Application Languages > Ada, then click Ada Formatting Options.
Languages similar to Ada may have similar Formatting Options screens that are not specifically documented.
The Keyword case option specifies the case of keywords used by Syntax Expansion. For example, when you type the word "procedure" and the Keyword case is set to Upper case, the editor changes "procedure" to "PROCEDURE". The hyperlink indicates if Adaptive Formatting is on or off for this setting.
You can beautify Ada files and change the beautify settings by using the Ada Beautifier dialog box. This dialog box can be accessed from the main menu by clicking Format → Beautify, or by using the gui_beautify command.
To instantly beautify Ada code according to the settings that are selected on the Ada Beautifier dialog box, use the ada_beautify or ada_beautify_selection commands.
The following settings and operations are available on the Ada Beautifier:
Restrict to selection - When checked, only lines in the selection are beautified.
Sync extension options - When checked, the language options are updated to reflect any changes that these dialogs have in common.
Beautify - Beautifies current selection or buffer and closes the dialog box.
Reset - Restores the dialog box settings to the values that appeared when you invoked the dialog.
Save Settings - Saves beautify options in the uformat.ini file. These settings are used by the ada_beautify command.
The tabs on the Ada Beautifier are described in the sections below.
The following settings are available:
Indent with tabs - When checked, tab characters are used for leading indent of lines. This value defaults to the Tabs text box on the language-specific Indent options screen (see Language-Specific Indent Options).
Indent for each level (Syntax indent) - The amount to indent for each new nesting level. The words "Syntax indent" are in parenthesis to help indicate that this field has the same meaning as the Syntax indent text box on the language-specific Indent options screen (see Language-Specific Indent Options). By default, this text box is initialized with the current language setup setting.
Tab size - Specifies output tab size. The output tab size is only used if the Indent with tabs check box is enabled on the language-specific Indent options screen (see Language-Specific Indent Options). This value defaults to the Syntax indent text box on the options screen.
Original tab size - Specifies what the original file's tab expansion size was. It is necessary to know the tab expansion size of your original file to handle reusing indent amounts from your original file. Currently the beautifier only reuses the original source file's indenting for comments. This option has no effect if the original file has no tab characters.
Continued Lines
Max line length - Specifies the maximum length a statement line can be before it is wrapped to a new line. Set this value to 0 to preserve line breaks.
Continuation indent - Specifies how much to indent lines of statements which continue to the next line. This has no affect on assignment statements or parenthesized expressions. Lines which are a continuation of an assignment statement are indented after the first equal sign (=). Lines which are a continuation of a parenthesized expression are indented after the open paren.
Operator position - Specify where the operator should be positioned when breaking a statement across multiple lines. For example, given the statement:
Seconds := Days * Hours_Per_Day * Minutes_Per_Hour * Seconds_Per_Minute ;
An operator position setting of End of same line would result in:
Seconds := Days * Hours_Per_Day * Minutes_Per_Hour * Seconds_Per_Minute ;
An operator position setting of Beginning of next line would result in:
Seconds := Days * Hours_Per_Day * Minutes_Per_Hour * Seconds_Per_Minute ;
The following options are available on the Statements/Declarations tab:
Reserved word case - Specifies the case for reserved words. For example, if you choose UPPER, then the Ada reserved word "procedure" would be beautified to "PROCEDURE".
One statement per line - When checked, only one statement is allowed per line of code.
One declaration per line - When checked, only one declaration is allowed per line of code.
One parameter per line - When checked, only one parameter is allowed per line of code in a formal parameter list of a subprogram specification.
One enumeration per line - When checked, only one enumeration is allowed per line of code in an enumerated type definition.
This tab allows you to specify how certain operators and separators are padded. The following options are available:
Item - Syntactic item to which padding settings get applied.
The "Binary operators" item includes: + - * / ** := = /= => <= >= < >
Padding Before - When checked, one space is placed before the item.
Padding After - When checked, one space is placed after the item.
Padding Preserve - When checked, the original padding (or lack of padding) around the item is preserved.
The following options are available on the Vertical Alignment tab:
Align on declaration colon - When checked, adjacent declaration lines (including parameter specifications) have their colons vertically aligned. For example, before beautify:
procedure foo ( A_Var : Boolean ; Another_Var : Boolean) ;
After beautify:
procedure foo ( A_Var : Boolean ;
Another_Var : Boolean ) ;Align on declaration in-out - When checked, the modes of parameter specifications in the formal part of a subprogram declaration are vertically aligned. For example, before beautify:
procedure foo ( A_Var : in Boolean ; Another_Var : in out Boolean);
After beautify:
procedure foo ( A_Var : in Boolean ;
Another_Var : in out Boolean ) ;The following options are available on the Blank Lines tab:
Item - Syntactic item to which blank lines settings get applied.
Subprogram declaration - Procedure or Function declaration.
Subprogram body - Procedure or Function body.
Type declaration - Any declaration that begins with the reserved word "TYPE".
for-use - Aspect clause. For example:
for Medium Size use 2*Byte;
Subunit comment header - The comment block that appears just before a subunit (e.g. Procedure body, etc.).
begin/end - Any line that starts with the reserved words "begin" or "end."
if/elsif/else - The if, elsif, and else parts of an if statement.
return - Any line that starts with the reserved word "return."
Loops - Loop statements (e.g. loop, while, for).
Nested paren list item - A parenthesized item that is itself enclosed in a larger parenthesized list. For example, before beautify:
Default_Data : constant Data_Type :=
( A_Set => ( others => ( Item1 => false , Item2 => false , Item3 => false ) ) , -- Paren-d item enclosed in larger paren-d list
B_Set => ( others => ( Item1 => false , Item2 => false , Item3 => false ) ) ) ;After beautify:
Default_Data : constant Data_Type :=
( A_Set => ( others => ( Item1 => false ,
Item2 => false ,
Item3 => false ) ) , -- Paren-d item enclosed in larger paren-d list
B_Set => ( others => ( Item1 => false ,
Item2 => false ,
Item3 => false ) ) ) ;Before - Specify how many blank lines are inserted before item.
After - Specify how many blank lines are inserted after item.
Between - Specify how many blank lines are inserted between like items.
The following options are available on the Comments tab:
Comment lines immediately below a type declaration indented by - The amount to indent a comment appearing immediately below a TYPE declaration.
Trailing comments - Trailing comments appear at the end of lines which contain statements or declarations. For example:
A := B + C ; -- This is a trailing comment -- This is not a trailing comment procedure foo ( A_Var : Boolean ) ;
Specific column - When selected, trailing comments are placed at the specified column.
Indent by - When selected, trailing comments are indented by the specified number of columns after the last character of the end of the statement or declaration.
Original relative indent - When selected, trailing comments are indented by reusing the indent after the last character of the end of the statement or declaration of the original source file.
Force type declaration comments to next line - When selected, trailing comments appearing at the end of a TYPE declaration line are forced onto the next line.
The following options are available on the Advanced tab:
if-then-else continued lines - Use these advanced options to customize how multi-line conditional expressions of an if-then-else statement are indented.
Force a linebreak on logical operators - A line break is forced before/after (depending on your Operator position setting) every logical operator in the condition of an if/elseif. For example, before beautify:
-- Indent per level = 3 -- Operator position = Beginning of next line if A = B and C = D then null ; end if ;
After beautify:
if A = B and C = D then null ; end if ;
Additional indent for logical operator - Additional indent amount for a line broken on a logical operator. This amount is in addition to the current indent level. For example, before beautify (Indent per level = 3; Operator position = Beginning of next line; Additional indent for logical operator = 3):
-- Indent per level = 3 -- Operator position = Beginning of next line -- Additional indent for logical operator = 3 if A = B and C = D then null ; end if ;
After beautify:
if A = B
and C = D then
null ;
end if ;Additional indent for logical operator when followed by another line that begins with logical operator - Additional indent amount for a line broken on a logical operator that is followed by another line that also is broken on a logical operator that is different. This amount is in addition to the current indent level, and in addition to the Additional indent for logical operator setting.
For example, before beautify (Indent per level = 3; Additional indent for logical operator = 3; Additional indent for logical operator when followed by another line that begins with different logical operator = 3):
-- Indent per level = 3 -- Operator position = Beginning of next line -- Additional indent for logical operator = 3 -- Additional indent for logical operator when -- followed by another line that begins with different logical operator = 3 if A = B and then C = D or else E = F then null ; end if ;
After beautify:
if A = B
and then C = D
or else E = F then
null ;
end if ;