- 19.12 (released) ...
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:
- These strings will be inserted right after the keyword. The key that triggers the automatic completion will not be taken into account, i.e. no space or "new line" character will be inserted even though you press Space or Return. The strings should therefore begin with a space or a "new line" character (see below for "newline").
- Two reserved words will allow you to position the cursor and to indent the text properly. Insert the word $cursor$ in the string where you want the cursor to be moved once the completion is finished. Insert the word $indent$ where you want to copy as many blank spaces as there were on the line where the keyword was typed.
- Three special characters are available:
- %N represents the new line character.
- %T represents the tabulation
- %B represents the back space
1) You want the lines of code :
if <cursor here> then
<one more tabulation>
as you press Space just after typing
To make this happen, you should define the "Customized auto complete (Space after keyword was typed)" string for
if as :
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
$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
2) You want the lines of code :
as you press Return just after typing
To make this happen, you should define the "Customized auto complete (Return after keyword was typed)" string for
end as :
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.