editing:auto_completion:braces

Action unknown: addtobook

Auto Brackets

The name of the feature is actually misleading and could be named as auto-braces or auto pair symbols. But independently of the name, functionality used for an auto-closing open symbol by closing symbol.
In addition, functionality is also responsible for deleting of pair symbols together; if a close symbol is deleted and there is only white space between of both symbols.

Here is the list of rules used:

  • Editor does not do the parsing for all previously open/close pair symbols. It will just add the closing one or remove both (both are only removed if the close symbol is deleted and there's nothing but white space between it and the open symbol)
  • For symmetric pairs (as “”) rules are more strict. You should have spaces (or delimiters) around
  • For asymmetric (as {}()[]), next char should be delimiter, otherwise close symbol will not be added
  • Auto adding does not work in “text” styles (comments, strings)
  • If you type open + close symbol fast HippoEDIT will “eat” auto-added. But if you do it after a bigger delay, you would get “duplicated” close one. This is by design. Editor remembers only last auto closed pair, but not all of them.
  • Editor executes adding of pair symbol action only after typing open symbol
  • Deletes back both pair symbols, if there is no other characters or white space between open/close symbols
  • There is similar function exists, that can be useful: Surround Selection. If you select some text and then press any of open symbols, selection should be surrounded by open close symbol.
You can temporary disable Auto-Brackets feature for all syntaxes using Edit.ToggleSmarties command.

To achieve behavior with different formatting for some of the pair symbols, you can use code templates. Add code template with { (or any open brace defines in OpenClose) as a key and text like this:

{
    %|% 
}

And after typing { you would see tooltip for expanding template or you can directly call it with Ctrl+Enter or get code automatically inserted (as for pair symbol). Behavior depends on text position.

Everything is based on symbol pairs defined in OpenClose node of spec XMLs of current syntax and can be modified by direct changing of this setting in schema file.