6.1.7. Automatic Construct ClosingΒΆ

While editing Ada source files, you can invoke the “Insert End” command to insert the required text to close a construct.

The editor command is bound to the Alt+End key sequence and is also available via the Ada menu on the menubar and the editor’s contextual menu.

For constructs without an associated name, such as record type definitions and if-statements, the Insert End command will insert the corresponding simple completion.

For example, the following figure shows an incomplete record type definition with the Insert End command about to be invoked:

example closing of record type definition before invocation

After invocation, the closing “end record;” sequence has been inserted and properly indented relative to the word “record”:

example closing of record type definition after invocation

For the end of a program unit’s sequence of statements, the action will insert the “end” followed by the name of the unit.

For example, the next figure shows a procedure Demo without the closing “end”. Note that the cursor is indented as if another statement is about to be entered:

example closing of subprogram before invocation

After invocation, the closing “end Demo;” sequence has been inserted and properly indented:

example closing of subprogram after invocation

Constructs with labels are completed in a similar manner.