6.2.2. Enabling Code Assist

Code Assist for Ada can offer completion candidates from the entire project. To do so, an entity database must be loaded. This loading occurs in the background, asynchronously, and does not force you to wait. However, if you want to disable this loading, simply disable the Code Assist preference. The preference is enabled initially, and, as a result, by default the entity database is loaded when GNATbench starts.

enabling code assist

6.2.3. Invoking Code Assist

Code Assist for identifiers is invoked by pressing the control+space key combination inside any Ada source file. This is the default key binding for all Eclipse editors that support the feature but users can change the key binding, as always.

To use this feature for simple identifiers, begin to type a name inside an Ada source file. This identifier must be declared either in the current file (and prior to the cursor location) or in one of the packages of the project loaded. With the cursor right after the last character of the incomplete identifier, press the Code Assist key sequence. Eclipse will open the Smart Completion window displaying all the known identifiers beginning with the prefix you typed. You can then browse among the various proposals using the Up and Down keys or using the scrollbar. Typing additional letters of the identifier will reduce the range of proposals as long as possible candidates remain.

Once you’ve selected the intended completion you can apply it by pressing Enter. The identifier will be completed with that selection and you can continue to enter further text.

You may reject the list of candidates and terminate Code Assist by pressing the Escape key.

Code Assist is automatically invoked when entering dotted names and when entering parameters for a subprogram call. The Smart Completion window will open when the dot or the open (i.e., left) parenthesis is entered. Code Assist is not invoked if another character is entered in a short amount of time, so that touch typists are not inconvenienced.

When entering parameters for a subprogram call, you can manually invoke Code Assist after entering some of the parameters to see proposals for the remaining parameters, if any.