dmarcotte/idea-handlebars — pull request #9 by dmarcotte (2012-07-30 01:10:10+00:00)
Title: Auto insert close block 'staches (WIP)

When an open block type 'stache is typed (i.e. `{{#openBlock}}` or `{{^openInverse}}`), we auto-insert the corresponding close 'stache (i.e. `{{/openBlock}}` or `{{/openInverse}}`).

This is modelled directly on how HTML/XML close tag auto-insertion works in IDEA. The insert happens on entering the last `}`, and we leave the caret placed between the open and close 'staches so that the user can immediately start typing.

This branch also includes smart placement of the caret when `Enter` is typed between an open and close 'stache. More precisely, if the caret is position as follows:

```
{{#block}}|{{/block}}
```

then pressing enter yields

```
{{#block}}
|
{{/block}}
```

(Once formatting is implemented, this will improve further and auto-indent to the correct place)

Finally: the auto-insert can be toggled on and off from the Setttings->Handlebars page.