The COBOL Editor incorporates content assist thereby providing context sensitive content completion automatically or upon user request. Popup windows (infopops) are used to propose possible choices to complete a COBOL phrase. The user can select these choices for insertion in the text or hit the escape key in order to close the infopops without making a choice. Refer Fig 1.
The auto activation mechanism is as follows. Once the user enters a valid COBOL verb followed by a space, the editor waits 500ms to detect a character insertion by the user. If none is detected then the popup is displayed. If the user enters a key before the time interval then the popup is not activated. The auto activate mechanism as well as the time delay can be adjusted in the WorkSpace preferences settings. Refer Fig below.
The default setting is to disable auto activation for content assist.
The popup can also be requested manually by placing the cursor immediately after or no greater than a single space following the verb and hitting <Ctrl> + Space keys. Once the popup has been displayed the user can filter the list by typing in the editor. Refer Fig 2.
The popups contain selection information based on the last compilation of the COBOL program. Therefore it is required that the program be compiled at least once successfully in order to display context help. If the program has not been compiled or the last compilation results in an error then context help is not available.
For copybooks the context help is obtained by default from the last program that was compiled using the copybook. If the user wishes to refer to context help based on usage in any other program, then they can do so by using the "Setup Content Assist" menu option. Right click anywhere in the COBOL editor and select the "Setup Content Assist..." menu option. There are 3 possible outcomes. If the copybook has not been used and compiled in any program yet then a message will be shown to that effect. If the copybook has only been used in a single program then a message will displayed with the currently associated program name. If there are multiple programs that make use of the copybook then a dialog is displayed allowing the user to make a selection from those programs.
Refer to Fig 3 & Fig 4.
The following is the list of COBOL reserved words for which content assist completion is currently available:
For situations in which COBOL data has to be referenced a different popup UI is used as shown in Fig 5.
The Tree structure contains the COBOL data from the various sections of the DATA division. The grouping is program->section->elements. The user can manually traverse the tree control and select the data element to be inserted (double click or <Enter/Return>) . Use the tab key or the mouse to shift focus between the tree control and the search field. The search field can be used to lookup an element. For similarly named elements, hitting the <Enter/Return> key will traverse to the next element if any. Once an element has been selected in the tree control, the user can insert it into the program by either double clicking on the element or pressing the <Enter/Return> key on the tree control. The default behavior is to insert all uppercase. Use the combination of Shift key to insert all lowercase and Alt key to insert the qualified name of the element.
The COBOL data content assist is available for the following COBOL reserved words and operators
ACCEPT, ADD, BY, AND, COMPUTE, CORR, CORRESPONDING, DISPLAY, DIVIDE, EQUAL, FROM, GIVING, IF , INSPECT, INTO, MOVE, MULTIPLY, OF, OR, REDEFINES, REMAINDER, RENAMES, RETURNING, SEARCH, SET, STRING, SUBTRACT, TALLYING, THAN, TO, UNSTRING, INITIALIZE, =, >, <, >=, <=
In order to manually invoke the auto complete on data variable names, type in the initial few characters of the variable name and then either hit the <Ctrl> <Space> key combination or right click and select "Content Assist". This will cause the assist window to popup with the initial characters entered into the search field.
Content assist has also been made available for the '$SET DIRECTIVE' statement. The assist window that pops up is shown below.
For compiler directives that require parameters, the user can click on the column and it will open an appropriate editor for that directive. The editor can be either a textbox, numeric textbox, combo box or file directory selection dialog.
For those that do not require any parameters, either double click or hit the enter key to insert the directive.