Parameters indentation (on new line)
Answered
Is there a way to format function parameters to a new line but without indentation, or with a classic indentation ?
I found the same question in this SO post: https://stackoverflow.com/questions/39396319/is-there-a-way-to-get-intellij-to-back-indent-method-declaration-parameters
But the answer is not clear.
If we need to import a checkstyle config, where can I find a config which do such a thing ?
Thx
Please sign in to leave a comment.
You can try importing google_checks.xml from the CheckStyle distribution.
Can you share the source file which gets formatted incorrectly with this configuration?
Google_checks.xml does not do what I would like.
Currently :
What I would like :
Note the indentation, it is one more than the code inside the function to avoid confusion.
But in fact, the needs can be extended to many other similar use-cases :
Currently :
What I would like :
The following formatting looks like what you describe:
Yes indeed, but there is no parameters indentation so the code in the function is aligned with parameters, is there a way to add an indentation for parameters ?
> so the code in the function is aligned with parameters
It's not.
Code style.
Result:
Thanks !
I think you would want to say "It is" ! Because your config do exactly what I would like :)
To resume :
- Method and declaration parameters > new line after '('
- Tabs and indent > continuation indent (should be the double of indent)
Glad that you've figured it. My comment was a reply to yours "so the code in the function is aligned with parameters". Sorry for the confusion.
I think it's achieved through the indentation parameters in the first tab. In my case I have:
In the XML file:
Code snippet: