Online Eiffel Documentation
EiffelStudio

Keyword completion customization

This document describes the syntax used to customize keyword automatic completion.
Four strings are used to define the completion of a keyword. The rules are the same for all of them:

Examples :

  1. You want the lines of code :

    if
    next_line_of_code

    to become:

    if <cursor here> then
    <one more tabulation>
    end
    next_line_of_code

    as you press Space just after typing if. You should define the "Customized auto complete (Space after keyword was typed)" string for if as :

    " $cursor$ then%N$indent$%T%N$indent$end"

    First, EiffelStudio editor has to insert a blank space after if. The string begins therefore by a blank space.
    Then, $cursor$ tells EiffelStudio to move the cursor to this position after the completion.
    then is inserted after the cursor position.
    %N indicates that you want to insert a new line after then.
    $indent$%T means that this line is filled with as many blank spaces as there are before if plus a tabulation.
    Another line is inserted with %N.
    Then $indent$end means that end will be inserted in this new line with the same indentation as if.

  2. You want the lines of code :

    end
    next_line_of_code

    to become:

    end

    next_line_of_code

    as you press Return just after typing end. You should define the "Customized auto complete (Return after keyword was typed)" string for end as :

    "%B%B%B%Bend%N$indent$%B$cursor$"

    The four %B will remove end plus one character before end (the tabulation character).
    end will be inserted at this new position.
    %N indicates that you want to insert a new line.
    $indent$%B$cursor$ means that the cursor will be moved to the end of the line where one less blank space than before the original end will have been inserted.

Note: EiffelStudio editor can insert spaces instead of tabulation when you use special character %T. This is set in another section of the preferences.

See Also
Keywords automatic completion preferences
Default values for keyword completion preferences