Request for one more space style...

Our project requires all the parentheses be surrounded by space. Now I can do most of it except for () using IntelliJ. If I have a code that does not conform to the style but has ( ), the reformatting replaces ( ) with ().

Can we add one more line to the space tab to support ( ) as coding style?

vinay

PS: Please no flames for asking for ( ). The project style wants it that way.

19 comments
Comment actions Permalink

Can we add one more line to the space tab to support ( ) as coding style?

vinay


while we're at it: for assignment statements i'd like to have no space
before the '=' but one after, e.g. int i= 1;

could we please add another line to the space tab for this?

thanks,
greg

0
Comment actions Permalink

Oh yes, and since Christmas is drawing near: I would like to be able to configure my style to always have a blank line right before the final closing brace of a class.

Regards,
Jens

0
Comment actions Permalink

And I'd like to NOT have a blank line before the closing brace, and have IDEA automatically strip it out if there's one.

And, oh yes, I'd like IDEA to read my mind. There's a SCR for that, but I can't find it right now :)

0
Comment actions Permalink


I've had a tracker item for "Strip out blank lines before closing braces and after opening braces" open for something like two years now. Ya'll get in line.

--Dave

0
Comment actions Permalink

I am in line! My tracker for automatically adding a blank after methods (as defined in Code Style) is getting close
to a year now.

/Mikael

0
Comment actions Permalink

And I don't want to have any blank line before a closing }.

Tom

0
Comment actions Permalink

And I don't want to have any blank line before a
closing }.


The blank line before any closing } may be removed with 'Reformat Code' if you set 'Keep Blank Lines' to 0 (under IDE Settings - Code Style - Blank Lines).

0
Comment actions Permalink

But this option removes all other empty lines as well - even those I
want to keep.

Tom

0
Comment actions Permalink

Good thing, that's exactly what I need ^^ I'm stepping out of the line, hoping that you get on earlier :)

0
Comment actions Permalink

+1 to removing empty lines after { and before }.

And I'd like my array initializations to look like:
String[] {"one", "two"}
instead of:
String[]{"one", "two"}
that is a space between the ] and {.

///Odd

"Thomas Singer" <idea@NOregnisSpam.de> wrote in message
news:bpficf$387$1@is.intellij.net...

But this option removes all other empty lines as well - even those I
want to keep.

>

Tom

>


0
Comment actions Permalink

And there's still the long standing request for spaces inside of the curly
braces for array initializers...

String[]/space/{/space/"one",/space/"two"/space/}

;ted

"Odd Möller" <odd.moller@cypoint.se> wrote in message
news:bpfk72$fmu$1@is.intellij.net...

+1 to removing empty lines after { and before }.

>

And I'd like my array initializations to look like:
String[] {"one", "two"}
instead of:
String[]{"one", "two"}
that is a space between the ] and {.

>

///Odd

>

"Thomas Singer" <idea@NOregnisSpam.de> wrote in message
news:bpficf$387$1@is.intellij.net...

But this option removes all other empty lines as well - even those I
want to keep.

>

Tom

>

>
>


0
Comment actions Permalink

I'll put these on my list of things to do for the tabifier and rearranger plugins. Rearranger can easily adjust spacing around method declaration curly braces.

Tabifier has to take all those code style settings for "space before" and "space after" into account anyway, so I can add some options:

Rearranger options (if unchecked, lines are unaffected):

-Dave

0
Comment actions Permalink

Dave wrote:

I'll put these on my list of things to do for the
tabifier and rearranger plugins. Rearranger can
easily adjust spacing around method declaration curly
braces.



Rearranger options (if unchecked, lines are
unaffected):

>

- force one/no blank line after opening brace
- force one/no blank line before closing brace


Will that be fine-grained enough to distinguish between braces opening/closing a class, a method, a block?
Because I always want a blank line before a brace closing a class but not before braces closing a method.

Regards,
Jens

0
Comment actions Permalink

Yes, the tabifier distinguishes braces based on Java syntax, so class, method, code block, array initializers, and any other brace locations I've forgotten can be treated independently. Thanks for bringing it to my attention, though. I'll add separate blank line controls for class and method braces.

MFG - Dave

0
Comment actions Permalink

I enhanced the Tabifier plugin version 4.5 to do the spacing requests you folks made:

- Space between empty parentheses "( )" for Vinay

- Remove space before assignment operator "int i= 5;" for Greg

- Space before array initialization left brace for Odd

- Spaces within non-empty array initializer for Ted


Give it a whirl, if you like --

-Dave

0
Comment actions Permalink

That's great!
Thanks a lot!

///Odd


"Dave Kriewall" <no_mail@jetbrains.com> wrote in message
news:27365472.1070879094194.JavaMail.javamailuser@localhost...

I enhanced the Tabifier plugin version 4.5 to do the spacing requests you

folks made:
>

- Space between empty parentheses "( )" for Vinay

>

- Remove space before assignment operator "int i= 5;" for Greg

>

- Space before array initialization left brace for Odd


- Spaces within non-empty array initializer for Ted


>

Give it a whirl, if you like --

>

-Dave



0
Comment actions Permalink

Jens,

Rearranger 1.6 allows you to force a blank line before the closing brace of a class. (Merry Christmas!)

Marcus, you can also have it strip out a blank line there.

Dave G & Odd, it will strip out blank lines before closing braces and after opening braces (i.e. in code blocks.)

Mikael, it will add a blank line after methods.

Thomas, it will strip out blank lines before any closing brace, if that's what you want.

Hope this helps,
-Dave

0
Comment actions Permalink

Jens,

Rearranger 1.6 allows you to force a blank line
before the closing brace of a class. (Merry
Christmas!)


'Tis the season to be jolly! Thanks a lot, Dave!

Jens

0
Comment actions Permalink

Dave Kriewall, satisfiying all your space needs since 2003 ^^

0

Please sign in to leave a comment.