[[Property:title|Keyword completion customization]]
[[Property:weight|2]]
[[Property:uuid|5e41f619-9a27-d7a3-c722-07f7227c8952]]
This document describes the syntax used to customize keyword automatic completion. <br/>
[[Keywords automatic completion preferences|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 
<br/>


Examples :

1) You want the lines of code :

<code>
if 
next_line_of_code
</code><br/>

to become: 

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

as you press Space just after typing <code>if</code>. 

To make this happen, you should define the "Customized auto complete (Space after keyword was typed)" string for <code>if</code> as : 

<code lang="text">
$cursor$ then%N$indent$%T%N$indent$end
</code>

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


2) You want the lines of code :

<code>
end
next_line_of_code 
</code>

to become:

<code>
end

next_line_of_code 
</code>

as you press Return just after typing <code>end</code>.

To make this happen, you should define the "Customized auto complete (Return after keyword was typed)" string for <code>end</code> as : 

<code lang="text">
%B%B%B%Bend%N$indent$%B$cursor$
</code>

The four ''%B'' will remove <code>end</code> plus one character before <code>end</code> (the tabulation character). <br/>
<code>end</code> will be inserted at this new position. <br/>
''%N'' indicates that you want to insert a new line. <br/>
''$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 <code>end</code> will have been inserted. 


{{note|EiffelStudio editor can insert spaces instead of tabulation when you use special character ''%T''. This is set in [[General Editor Preferences|another section of the preferences]] .}}

{{seealso|<br/>
[[Keywords automatic completion preferences|Keywords automatic completion preferences]]  <br/>
[[Default values for keyword completion preferences|Default values for keyword completion preferences]]  <br/>
}}




