#837 Auto-Insert Matching Brace/Parenthesis?

Neil Hodgson
SciTE (231)
Mehrdad N.

Some more suggestions:
A _tremendously_ helpful set of features would be if SciTE had the ability to do the following (either by default or via options):

1. In addition to auto-aligning braces, actually *inserting* the closing brace for you. E.g., when you type in:
int main()
it should automatically put a brace at the same indentation on the next line, so that you don't have to go down-and-up again.

2. Brackets/parentheses/quotes should be able to be inserted in pairs automatically; _however_, if the user attempts to close the symbol manually, SciTE should try to _overwrite_ an existing matching symbol immediately to the right. E.g. if the user types in
int main(|
then SciTE should auto-complete it to
int main(|)
)where the pipe symbol is the cursor). However, if the user accidentally closes the parentheses, SciTE should _overwrite_ the next parenthesis instead of _adding_ to it (I believe this is what Eclipse does? or some other IDEs at least). This should happen even if the parentheses would become unbalanced, because the user can simply balance them again by continuing to close the parentheses. (It works quite well in practice, even though it may sound silly in theory.)

Of course, I'm not saying that these should be the default behaviors -- options would work well too. :)

It is NOT possible to do this accurately with Lua; I've tried it. The indentation gets messed up as soon as the situation slightly changes, and it's quite difficult to fix because there's no way to handle a keypress _after_ it's already been handled by SciTE. So it would be best if SciTE simply had these features.



  • Neil Hodgson
    Neil Hodgson

    • assigned_to: nobody --> nyamatongwe
    • priority: 5 --> 3
  • Neil Hodgson
    Neil Hodgson

    There is one example of this in SciTE: xml.auto.close.tags. I personally strongly dislike automatically inserted braces in other editors - it just goes wrong far too often and I have to watch my input be wrecked and then undo the damage.

    I may accept a well behaved option but will not be working on it myself.

  • Mehrdad N.
    Mehrdad N.

    What exactly would you consider "well-behaved"?
    I don't want to waste hours on trying to make this work, only to see that it wouldn't be accepted, so it might help to know what you would accept first.

  • Neil Hodgson
    Neil Hodgson

    I am not sure exactly what I would consider "well behaved". There are so many, many ways to go wrong.

    You should not be working on code where that work is justified by being included in SciTE since it may not be accepted. You should only implement features that you, yourself need enough to implement or find enjoyable to work on.