Title: RE: [Eap-list] Suggestions for improving auto { }

It happened to me, too, some time ago, but then I found that the number of closing braces didn't match the number of opening ones in that file (after I mistakenly cut some code). Since IDEA doesn't always show the errors for this type of problem, you might think your code is OK. IDEA does try to match the braces when the "auto {}" is invoked.

Edwin, try to compile the code, you might find it fails.

Valentin, IDEA should show an error for this code block
        void test(){
                if(condition){
                       
                }
                else{
                        //
                //note the missing brace               
        }
After deleting the brace, the file still looks valid, but the {} completion is not working properly anymore. After another error is reported, this one is caught as well.

HTH,
Andrei

> Regarding the second problem (with pressing enter after '{'
> in an already
> closed block), I cannot reproduce it. It should work
> correctly in this case.
> Could you send us an example where this problem is
> reproducable please?
>
> > The same
> > applies to other places, such as after an else clause. A
> similar thing
> > happens when editing:
> >
> >     if (condition) {
> >         foo1();
> >         foo2();
> >     }
> >
> > When I need to add a statement before foo1() I'm accustomed
> to position
> the
> > caret atfer the if () { and press Enter there. However, I then get a
> similar
> > problem:
> >
> >     if (condition) {
> >         |
> >     }
> >         foo1(); // code placed outside the block: not as intended
> >         foo2();
> >     } // unmatched closing brace
> >
> > It would be nice if IntelliJ could detect that the block is
> already closed
> > and omits inserting the closing brace.
> >
> > Greetings,
> > Edwin Delsman
> >
> >
> > _______________________________________________
> > Eap-list mailing list
> > [EMAIL PROTECTED]
> > http://www.intellij.com/mailman/listinfo/eap-list
>
>
> _______________________________________________
> Eap-list mailing list
> [EMAIL PROTECTED]
> http://www.intellij.com/mailman/listinfo/eap-list
>

Reply via email to