Euphoria Code Auto-completions using "snippets"

new topic     » goto parent     » topic index » view thread      » older message » newer message

Geany supports code completion based upon settings in a file called "snippets.conf". As I have reported earlier in this thread, I have edited various files and sections of files for the language "lua" to support Euphoria. Inserting the following section in the file "snippets.conf" enables auto-completion of various Euphoria statements as illustrated below, provided "snippet completions" has been selected in the Preferences/Editor/Completions" menu found under Geany's edit menu.

[Lua] 
procedure=procedure %cursor%(%cursor%)\n\t%cursor%\nend\sprocedure\n\n%cursor% 
function=function%cursor%%cursor%)\n\t%cursor%\nreturn%cursor%\nend\sfunction\n\n%cursor% 
if=if %cursor% then\n\t%cursor%\nend\sif\n\n%cursor% 
ifdef=ifdef %cursor% then\n\t%cursor%\nend\sifdef\n\n%cursor% 
while=while %cursor% do\n\t%cursor%\nend\swhile\n\n%cursor% 
loop=loop %cursor% do\n\t%cursor%\nend\sloop\n\n%cursor% 
for=for %cursor% =  %cursor% to %cursor% do\n\t%cursor%\nend\sfor\n\n%cursor% 
switch=switch %cursor% do\n\t%cursor%\nend\sswitch\n\n%cursor% 
type=type %cursor%(%cursor%)\n\treturn %cursor%\nend\stype\n\n%cursor% 

Once the initial "word" of one of the statements has been completed, pressing the tab key will complete the insertion of the code snippet.

Typing "procedure"+tab inserts the code snippet as follows:

procedure *(*) 
    * 
end procedure 
 
* 
-- the first asterisk after procedure represents the initial placement of  
-- the cursor upon insertion of the code snippet. By pressing <alt>t the  
-- cursor advances to the next cursor position. The configurable keyboard 
-- short cut is assigned to "move cursor in snippet" in the Keybindings  
-- section of the Preference menu. 
 
function *(*) 
    * 
return * 
end function 
 
* 
-- and so on. Of course you do not have to set all the cursor position 
-- markers. I like finishing up with the cursor positioned a couple of 
-- spaces below the end of the last word of the statement. One is enough 
-- though.  
 
-- without cursor placement markers, this is what is produced by the rest 
-- of the code snippets. 
 
ifdef  then 
 
end ifdef 
 
while  do 
 
end while 
 
loop  do 
 
end loop 
 
for  =   to  do 
 
end for 
  
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu