These code style features to support OLSD: https://uvsmtid.com/obsessive-line-splitting-disorder-index/
This was submitted as this request to IntelliJ: https://intellij-support.jetbrains.com/hc/en-us/requests/1048712
Inconsistently missing options for auto-formatting / Wrapping and Braces / Java / Code Style / IntelliJ / 2017.1.3
Such option would be equivalent to "New line after (
" under "Method declaration parameters" section.
Now, the auto-formatted code looks like this:
// [?] Why first element in interface list has to be attached to the `implements` keyword?
class ThisIsASampleClass
extends C1
implements I1,
I2,
I3,
I4,
I5
The requested option "New line after implements
" would make it look more regular:
// [!] Every list item (and only list item) on a separate line looks more elegantly!
class ThisIsASampleClass
extends C1
implements
I1,
I2,
I3,
I4,
I5
Such option would be equivalent to "New line after (
" under "Method declaration parameters" section (or many other sections).
Now, the auto-formatted code looks like this:
// [?] Why first element in parameter list has to be attached to the annotation name?
@Annotation1(param1 = "value1",
param2 = "value2",
param3 = "value3")
@Annotation2
@Annotation3(param1 = "value1",
param2 = "value2")
@Annotation4
class Foo
{}
The requested option "New line after (
" would make it look more regular (making it possible to match conventions like method arguments have):
@Annotation1(
param1 = "value1",
param2 = "value2",
param3 = "value3")
@Annotation2
@Annotation3(
param1 = "value1",
param2 = "value2")
@Annotation4
class Foo
{}
Such option would be equivalent to "Place )
on new line" under "Method declaration parameters" section (or many other sections).
It will also provide similar visual appearance as closing }
at the end of statement block.
Now, the auto-formatted code looks like this:
// [?] Why not allow making opening `(` and closing `)` visually resembling opening `{` and closing `}`?
@Annotation1(
param1 = "value1",
param2 = "value2",
param3 = "value3")
@Annotation2
@Annotation3(
param1 = "value1",
param2 = "value2")
@Annotation4
class Foo
{}
The requested option "Place )
on new line" would make it look more regular (making it possible to match conventions like method arguments have):
// [!] Opening `(` and closing `)` visually resemble opening `{` and closing `}`!
@Annotation1(
param1 = "value1",
param2 = "value2",
param3 = "value3"
)
@Annotation2
@Annotation3(
param1 = "value1",
param2 = "value2"
)
@Annotation4
class Foo
{}
Such option would be equivalent to "Align throws
to method start" under "Throws list" section.
Now, the auto-formatted code looks like this:
// [?] Why not indicate that interface list items are children of their `implements` keyword "parent" by indenting them?
class ThisIsASampleClass
extends C1
implements
I1,
I2,
I3,
I4,
I5
The requested option "Align extends
/implements
to class start" would make it look more regular:
// [!] Elements are idented under `implements` keyword just like any other lists (argument lists to functions, list of statements in block, etc.)!
class ThisIsASampleClass
extends C1
implements
I1,
I2,
I3,
I4,
I5
5. "Method declaration parameters" section misses option "Place {
on new line after throws
exception list".
In majority of cases, when throws
is not specified for function, the opening {
starts at the same line:
public void test() {
return;
}
However, when throws
provides list of exceptions, it would be more natural to break the line and start.
Otherwise, it appears as if opening {
has something to do with the last exception in the throw list.
Now, the auto-formatted code looks like this:
// [?] Why not place `{` on a new line to break appearing relationship with `Exception3`?
public void test()
throws
Exception1,
Exception2,
Exception3 {
return;
}
The requested option "Place {
on new line after throws
exception list" would bear no relation between last exception and the starting function body:
public void test()
throws
Exception1,
Exception2,
Exception3
{
return;
}