Last Friday's build of Elements includes some cool new typing improvements in Fire and Water's code editor that will, hopefully, safe you even more time while typing code – especially on Oxygene.

Smart End

First, the "Smart }" option that has been in C#, Swift and Java for a while now comes to Oxygene. When you press Enter behind "begin" (or other keywords that start a block), Fire/Water will automatically insert the "end;" for you, and place your cursor inbetween the two.

Of course, just as with "Smart }", it's smart about this, and will first check if the "end;" actually is required (i.e. no matching end is present, yet).

This works for most/all common block types, from begin/require/ensure/end to repeat/until.

Keyword Expansion

Second, we've introduced a new feature called "Keyword Expansion", available in all languages. As you type certain keywords and press Space, Fire/Water will automatically pre-insert the rest of the statement for you, in ways that will not get in the way of typing, and only when the inserted code is "inevitable".

For example, typing "if" followed by Space will insert "then" for you (in Oxygene), and keep the cursor placed between the two words, so you can keep typing the condition. The same for while and similar constructs.

In C# and Java, pressing Space after "if" will insert a pair of parenthesis for you and place the cursor between them – but worry not, if you move on to type the opening parenthesis yourself (because you're in the flow and not used to the new feature yet, for example), the editor will compensate and keep only one (. Type anything else, and the () pair is kept.

Pressing Space after "then" or "do" will automatically insert "begin" for you. Again, the editor is smart: if you go on typing something else, it will figure you did not want a begin/end block, and your typing replaces the begin. But if you go ahead and just press Enter, it stays (and the Smart End feature kicks in, of course).

Improved Smart-Indent

Smart-Indent (automatic indentation when you press Enter) has also been improved. For example, if you press Enter after , and Fire/Water detects that you are in an open ( or [, you will start the next line indented right to the parenthesis of the bracket – helpful when writing a long method call with many parameters, an enum, or an array literal.


Let us know what you think as you try these new enhancements in action!