Format Java/Groovy method parameters

Answered

When passing named parameters to a method call or new object is there an option to line up the parameters and parameter values into columns?  An example would be:

MyObject object = new MyObject(

       param1:     'paramval'

       param2:     'anotherparamval'

)

0
3 comments

Hello Derek,

For Java/Groovy you could configure "Method declaration parameters" and "Method call arguments" wrapping/aligning options in "File | Settings | Editor | Code Style | Java/Groovy - Wrapping and Braces"

 

 

0
Avatar
Permanently deleted user

I was able to get it half way to what I want.  By choosing "Wrap always" and then "Align when multiline". However, I can't find the option to space out the values from the parameter names. Right now I get this:

MyObject object = new MyObject(
    param1: 'paramval'
    param2withLongName: 'anotherparamval'
)

but what I really want is this:

MyObject object = new MyObject(
    param1:                               'paramval'
    param2withLongName:       'anotherparamval'
)

0

Derek,

I reported issue on YouTrack: https://youtrack.jetbrains.com/issue/IDEA-205451

Please follow it for updates.

0

Please sign in to leave a comment.