Autoclosed braces and cursor position


#1

I’m not sure if the current implementation is a bug, or if I’m asking for a feature. When the editor automatically creates a closing brace, the resulting cursor position is “wrong” based on how most editors operate.

In Atom, the cursor ends up the space before the closing brace which was created. In other editors (Netbeans, Sublime, PHPStorm), a blank line is created and the cursor indented on that blank line so you can continue typing immediately without repositioning the cursor - I would imagine this is preferred behavior for many people.


#2

This is one of the more noticeable pain points for me.

When the closing brace is created (when you type the opening brace), Atom acts the same as Sublime (I can’t speak to NetBeans or PHPStorm). All that’s done is the closing brace is added after the cursor. That, IMO, is the correct behavior.

The difference is when you press Enter. In Sublime, as you describe, a blank line is added with the appropriate indentation and the closing brace is below it. In Atom, there’s no blank line, so you need to reposition the cursor before you start typing.


#3

There is an open issue here https://github.com/atom/bracket-matcher/issues/7


#4

There is now also an implementation: https://github.com/atom/bracket-matcher/pull/12

If you want to, you can use the fork until someone hopefully merges that pull!