![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Compile > CompleteThe Compile > Complete command completes the designated item by inserting new text and prompts into the image using information about the syntax and semantics of the image. A semantic completion icon is also available on the top toolbar.
Specifically, Compile > Complete completes the selected identifier or the identifiers in the selected element using semantics for name resolution. The identifier is completed using the context that exists for the compilation of the selected element, including with clauses, use clauses, renaming declarations, and so on.
If more than one name can complete the identifier, a list of choices is displayed in a Completions viewer.
For example, enter the following code in the Ada editor:
![]()
Select Put_Line and then execute Compile > Complete. A viewer window appears, displaying the possible parameter conventions for Put_Line.
![]()
In the Completions viewer, select the desired completion and then execute Compile > Complete. This places the completion into the language editor.
You can double-click on a choice to display the associated package specification in an editor window. In the example above, double-clicking on one of the lines in the viewer window displays the Text_Io package specification.
Controling the Behavior of Completionthere might be circumstances under which finer control over completion is useful. If the Control key is depressed while clicking on the menu item Compile > Complete, the Completion Options dialog box is brought up:
The Completion Options dialog box has six tabs, which are described in detail below
General Tab
The General tab is the default tab of the Completion Options dialog box. It is the tab displayed in the figure above.
Control of Wildcarding
If the All identifiers are wildcards button is selected (the default) then the compiler assumes that each identifier in the selected area is a wildcard, and can be extended. This amounts to saying that each identifier has an implicit trailing @ character. This is useful when writing new code, since it makes it possible to type only the beginning of an identifier, and let completion figure out its meaning and extend it.
If the Only identifiers with @ are wildcards button is selected, then the compiler only considers as wildcards those identifiers that actually contain an @ character. This is useful when running completion on existing, legal code, since the identifiers don't need to be extended in this case. As a matter of fact, considering all identifiers as wildcards could result in ambiguities which could confuse completion.
Control of Constructs To Complete
The other six buttons appearing on the General tab specify which Ada constructs must be completed. This is mostly useful when running completion on a large amount of text.
Calls, Instantiations and Pragmas Tabs
These three tabs are very similar, and are discussed together in the following section.
Subprogram calls, generic instantiations and pragmas may all have optional arguments. For subprogram calls these are "in" parameters with a default expression. For generic units these are either "in" parameters with a default expression, or formal subprograms with a default name. For pragmas, which parameters are optional and which are mandatory is defined on a case-by-case basis.
By default, when completion expands such a construct, it generates associations for optional parameters. This behavior can be changed in the Calls, Instantiations and Pragmas tabs. For instance, if you run completion on a large body of existing code, and you make extensive use of defaulted parameters, making these parameters explicit might degrade the legibility of the code.
The Constraints Tab
When completion encounters a reference to an unconstrained type, it has to decide whether it must generate constraints or not. The Constraints tab makes it possible to control the circumstances under which constraints are generated.
If the Generate constraints for object declarations with initial value button is unselected (the default), then constraints are not generated for objects that are constrained by their initial value. For instance, the following code is unaffected by completion:
X : constant String := "abc";
If the Generate constraints for object declarations with initial value button is selected, constraints are generated even if there is an initial value, so the above declaration is completed into:
X : constant String ([POSITIVE-expression] .. [POSITIVE-expression]) := "abc";
The Statements Tab
The Statements tab controls the generation of choices and alternatives in case statements.
Generation of Choices
If the Generate range choices in case statements whenever possible button is selected, completion tries to generate ranges. In the following example, the choices Bottom, Charm and Strange are covered by the range Bottom .. Strange:
case X2 is when Up | Top => null; when Down | Bottom .. Strange => [statement] end case;
If the Generate single-valued choices in case statements button is selected, completion never generates ranges for enumeration types. So the completion for the same example case statement is:
case X2 is when Up | Top => null; when Down | Bottom | Charm | Strange => [statement] end case;
If the case expression is of an integer type, single-valued choices are never generated. This is to avoid the production of case statements with extremely large numbers of choices.
Generation of Alternatives
If the Generate one alternative for all the choices in case statements button is selected (the default), all the choices are grouped in a single alternative (this is the situation that was illustrated in the previous paragraph).
If the Generate one alternative for each choice in case statements button is selected, one alternative is produced for each choice. The completion of the above example case statement becomes, for range choices:
case X2 is when Up | Top => null; when Down => [statement] when Bottom .. Strange => [statement] end case;
and for single-valued choices:
case X2 is when Up | Top => null; when Down => [statement] when Bottom | [statement] when Charm | [statement] when Strange => [statement] end case;
Rational Software Corporation http://www.rational.com support@rational.com techpubs@rational.com Copyright © 1993-2001, Rational Software Corporation. All rights reserved. |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |