Closed bjansen closed 9 years ago
No love for <3
? Okay :(
List<String> D = ...
for (String happy :D) {
}
I'm not sure I agree with this. I tend to write x==1
instead of x == 1
.
@gavinking you also tend to set the maximum line width to 80 chars ;)
It's not that I'm advocating one or the other; I'm just saying that it's pretty much a personal preference, and so it should be selectable.
What part should be selectable? There’s already the option forceSpaceAroundBinaryOp
to completely disable this.
What part should be selectable?
Well if you're going to pander to @bjansen's ridiculously wrong aesthetic preference ;-P then I don't think you should force it down my throat. So forceSpaceAroundBooleanOp
would force the spacing only for comparison and logical ops.
Or, even better, you could have a hierarchy of these corresponding to the layers in spec §6.8: forceSpaceAroundComparisonOp
(layer 2), forceSpaceAroundLogicalOp
(layer 3), forceSpaceAroundConditionalOrAssignmentOp
(layer 4).
@lucaswerkmeister I assume this is not for 1.2
I like the hierarchy idea. I’d like to have this in 1.2, but it’s not blocking, so moving the milestone.
Holy shit I just noticed that this feature actually breaks code!
shared void run() {
String ema = "ema";
Character c = 'c';
Boolean b = true && c in ema;
}
formats to
shared void run() {
String ema = "ema";
Character c = 'c';
Boolean b = true && cinema;
}
Oops…
Ha! Take that, people who say I have wrong aesthetic preference ;)
I fixed that bug (eeef892).
@bjansen to fix this bug, put the following in your .ceylon/default.format
:
[formatter]
spaceOptionalAroundOperatorLevel=1
This omits spaces around arithmetic operators, but not comparison operators.
Currently, when an expressions uses multiple operators, the formatters groups them to show the precedence, for example:
a*b + c*d
instead ofa * b + c * d
While this is cool for arithmetic operators, I think it doesn't look as good on comparison operators:
aa===bb || 2<3
should beaa === bb || 2 < 3