Closed
Description
Describe the Feature
The sameLine.returnBody
option allows a complex return body to be moved to a new line.
However, it also forces real simple returns on the same line (e.g. return 10
becomes two lines), which is undesirable. It would be good if there was a way to have complex bodies such as if/else, switch etc. on a newline, and simple ones on the same line (the question is how exactly to distinguish simple from complex).
(Optional) Sample of desired output
class Main {
function a() {
return 10;
return x < 0 ? "negative" : "non-negative";
}
function b() {
return
if (x < 0) "negative";
else "non-negative";
return
switch y {
case "negative": -1;
case "non-negative": 1;
}
}
}