wish list, polish brace indentation

It is a fairly rare construct, but you can have a plain { ... } block
in Java that is not an if, while, try etc. It is most often used to
create a new scope so you can reuse temporary variable names.  The
catch is the code formatter refuses to indent the block.  It would be
nice to have the option to have empty blocks indented, or the current
"other block" brace indent option to apply to vanilla blocks too.
--
Roedy Green Canadian Mind Products
http://mindprod.com
One of the most useful comments you can put in a program is
"If you change this, remember to change ?XXX? too".

2 comments
Comment actions Permalink

Hi Roedy,

Current behavior is like below:

void test() {
    int outer1 = 1;
    {
        int inner = 2;
    }
    int outer2 = 2;
}


Am I right understanding that you're asking for the change like below?

void test() {
    int outer1 = 1;
        {
            int inner = 2;
        }
    int outer2 = 2;
}



Denis

0
Comment actions Permalink

On Thu, 12 Jan 2012 15:36:56 MSK, Denis Zhdanov
<no_reply@jetbrains.com> wrote, quoted or indirectly quoted someone
who said :

>Current behavior is like below:
>
>void test() {
>    int outer1 = 1;
>    {
>        int inner = 2;
>    }
>    int outer2 = 2;
>}
>
>
>Am I right understanding that you're asking for the change like below?
>
>void test() {
>    int outer1 = 1;
>        {
>            int inner = 2;
>        }
>    int outer2 = 2;
>}
>

no.

What I get now is:

       downloadDir = AppCat.getZipDir();
       {
        final FastCat sb = new FastCat( 6 );
        sb.append( downloadDir );
        sb.append( "/" );
        sb.append( computerName );
        sb.append( version.substring( 0, version.length() - 2 ) );
        sb.append( version.charAt( version.length() - 1 ) );
        sb.append( ".zip" );
        webrootRelativeDownload = sb.toString();
        }
        something();
        {
        final FastCat sb = new FastCat( 4 );
        sb.append( downloadDir );
        sb.append( "/" );
        sb.append( computerName );
        sb.append( "-setup.exe" );
        webrootRelativeDownloadJET = sb.toString();
        }
    
Why I would like is:

       downloadDir = AppCat.getZipDir();
            {
            final FastCat sb = new FastCat( 6 );
            sb.append( downloadDir );
            sb.append( "/" );
            sb.append( computerName );
            sb.append( version.substring( 0, version.length() - 2 ) );
            sb.append( version.charAt( version.length() - 1 ) );
            sb.append( ".zip" );
            webrootRelativeDownload = sb.toString();
            }
        something();
            {
            final FastCat sb = new FastCat( 4 );
            sb.append( downloadDir );
            sb.append( "/" );
            sb.append( computerName );
            sb.append( "-setup.exe" );
            webrootRelativeDownloadJET = sb.toString();
            }


--
Roedy Green Canadian Mind Products
http://mindprod.com
One of the most useful comments you can put in a program is
"If you change this, remember to change ?XXX? too".

0

Please sign in to leave a comment.