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'
)
Please sign in to leave a comment.
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"
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'
)
Derek,
I reported issue on YouTrack: https://youtrack.jetbrains.com/issue/IDEA-205451
Please follow it for updates.