#320 Smarter typing of closed curly braces

v0.4.x
open
nobody
Editor (234)
5
2006-10-12
2006-10-12
Dirk Bergstrom
No

When a closed curly brace preceded by a space is added
by smart typing, it should be placed on the next line,
properly indented. The cursor should remain where it
is. Like this:

Before typing open brace (cursor at 'I'):
if (blah) I

After typing open brace:
if (blah) {I
}

With the current system, I have to hit return twice,
then go up one line.

When a brace is immediately preceded by a character
(like a variable name), the closing brace should not be
put on the next line.

Discussion

  • Jan Ploski
    Jan Ploski
    2006-10-28

    Logged In: YES
    user_id=86907

    Correct autocompletion of closing curly braces is more complicated than what you suggest. We should
    basically reproduce the behaviour of JDT's Java editor. When you type an opening brace, no autocompletion
    happens at first - after all, maybe you want to close this block on the same line. However, if you press
    return immediately after the opening brace, a correctly indented closing brace is inserted, UNLESS the block
    is already terminated by an existing closing brace. In other words, we would have to count/match braces in
    the remaining source to determine whether a closing brace should be inserted or not. Tricky.