Code Assist

Code Assist features try to assist the user during source code editing.


The features currently implemented in EPIC are rudimentary. An option to utilize a user-defined script for code assist suggestions is provided to allow integration of more powerful, external code generation tools.

Variable Inspection

When you press one of the auto completion characters $ @ %, the editor displays all defined variables in a list. From the list you can select the variable that should be inserted in the source code.

Variable Inspection

Module Inspection

The editor tries to display methods available in modules when the auto completion characters > or : are entered.

Module Inspection


Currently, indirect object invocations are not recognized by code assist. This code block will not work:

$smtp = new Net::SMTP;
$smtp->[no content assist]

This one will work:

$smtp = Net::SMTP->new();
$smtp->[content assist]

External Content Assistant

If specified on the Code Assist preferences page, a user-defined Perl script can compute autocompletion suggestions instead of or in addition to EPIC's built-in ones. It is called by EPIC with the following arguments:

  • documentPath = workspace-relative path of the edited source file (if available),
  • documentOffset = selection start offset in the document/file (or caret position if there is no selection),
  • selectionLength = length of selection (0 if there is no selection),
and the entire source document is passed in as standard input.

Based on the provided information the script is supposed to generate on standard output a list of autocomplete suggestions or "proposals" which, if not empty, take precedence over EPIC's built-in generation. Each suggestion contains instructions to insert/replace a contiguous piece of text at a given position in the source document and move the caret to a new position. A suggestion is formatted as a comma-separated list of "replacementOffset,replacementLength,newCursorPosition,replacementString":

  • replacementOffset = where to insert the proposal in the file (typically = documentOffset),
  • replacementLength = how many characters to remove at this offset (typically 0, i.e. just insert),
  • newCursorPosition = where to place caret after the insertion, relative to replacementOffset (typically = replacementString.length()),
  • replacementString = what to insert at replacementOffset

Suggestions are separated from each other by the special <|proposal|> token.

Refer to the source code of org.epic.perleditor.editors.util.ExternalAutoComplete for further implementation details.