Skip to content

Commit

Permalink
feat: consistent indent between chained method on method and new object
Browse files Browse the repository at this point in the history
  • Loading branch information
clementdessoude committed Mar 13, 2021
1 parent e5c4817 commit 0781319
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/prettier-plugin-java/src/printers/expressions.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,10 @@ class ExpressionsPrettierVisitor {
suffixes.push(this.visit(ctx.primarySuffix[i]));
}

if (countMethodInvocation === 1) {
if (
countMethodInvocation === 1 &&
ctx.primaryPrefix[0].children.newExpression === undefined
) {
return group(
rejectAndConcat([
primaryPrefix,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,9 @@ public boolean binaryOperationWithComments() {

return a || b || c;
}

public void method() {
new Foo(stuff, thing, "auaaaaaaaaa some very long stuff", "some more").bar(10);
foo(stuff, thing, "some very longuuuuuuuuuuuuuu stuff", "some more").bar(10);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,11 @@ public boolean binaryOperationWithComments() {

return a || b || c;
}

public void method() {
new Foo(stuff, thing, "auaaaaaaaaa some very long stuff", "some more")
.bar(10);
foo(stuff, thing, "some very longuuuuuuuuuuuuuu stuff", "some more")
.bar(10);
}
}

0 comments on commit 0781319

Please sign in to comment.