prettier-plugin-java 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/package.json +4 -4
- package/src/printers/classes.js +1 -0
- package/src/printers/expressions.js +8 -9
package/LICENSE
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prettier-plugin-java",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Prettier Java Plugin",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"repository": "https://github.com/jhipster/prettier-java",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"java-parser": "1.0.
|
|
10
|
-
"lodash": "4.17.
|
|
9
|
+
"java-parser": "1.0.2",
|
|
10
|
+
"lodash": "4.17.21",
|
|
11
11
|
"prettier": "2.2.1"
|
|
12
12
|
},
|
|
13
13
|
"scripts": {
|
|
@@ -20,5 +20,5 @@
|
|
|
20
20
|
"test:all": "npm-run-all test test:e2e-jhipster1 test:e2e-jhipster2",
|
|
21
21
|
"clone-samples": "node scripts/clone-samples.js"
|
|
22
22
|
},
|
|
23
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "d4dbac80d37d361f314205956547becfafca685f"
|
|
24
24
|
}
|
package/src/printers/classes.js
CHANGED
|
@@ -167,7 +167,7 @@ class ExpressionsPrettierVisitor {
|
|
|
167
167
|
groupsOfOperator,
|
|
168
168
|
sortedBinaryOperators
|
|
169
169
|
} = separateTokensIntoGroups(ctx);
|
|
170
|
-
const
|
|
170
|
+
const segmentsSplitByBinaryOperator = [];
|
|
171
171
|
let currentSegment = [];
|
|
172
172
|
|
|
173
173
|
if (groupsOfOperator.length === 1 && groupsOfOperator[0].length === 0) {
|
|
@@ -212,7 +212,7 @@ class ExpressionsPrettierVisitor {
|
|
|
212
212
|
);
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
|
-
|
|
215
|
+
segmentsSplitByBinaryOperator.push(
|
|
216
216
|
group(rejectAndJoin(" ", currentSegment))
|
|
217
217
|
);
|
|
218
218
|
});
|
|
@@ -227,7 +227,7 @@ class ExpressionsPrettierVisitor {
|
|
|
227
227
|
group(
|
|
228
228
|
rejectAndJoinSeps(
|
|
229
229
|
sortedBinaryOperators.map(elt => concat([" ", elt, line])),
|
|
230
|
-
|
|
230
|
+
segmentsSplitByBinaryOperator
|
|
231
231
|
)
|
|
232
232
|
)
|
|
233
233
|
])
|
|
@@ -241,7 +241,7 @@ class ExpressionsPrettierVisitor {
|
|
|
241
241
|
return group(
|
|
242
242
|
rejectAndJoinSeps(
|
|
243
243
|
sortedBinaryOperators.map(elt => concat([" ", elt, line])),
|
|
244
|
-
|
|
244
|
+
segmentsSplitByBinaryOperator
|
|
245
245
|
)
|
|
246
246
|
);
|
|
247
247
|
}
|
|
@@ -341,7 +341,10 @@ class ExpressionsPrettierVisitor {
|
|
|
341
341
|
suffixes.push(this.visit(ctx.primarySuffix[i]));
|
|
342
342
|
}
|
|
343
343
|
|
|
344
|
-
if (
|
|
344
|
+
if (
|
|
345
|
+
countMethodInvocation === 1 &&
|
|
346
|
+
ctx.primaryPrefix[0].children.newExpression === undefined
|
|
347
|
+
) {
|
|
345
348
|
return group(
|
|
346
349
|
rejectAndConcat([
|
|
347
350
|
primaryPrefix,
|
|
@@ -583,10 +586,6 @@ class ExpressionsPrettierVisitor {
|
|
|
583
586
|
}
|
|
584
587
|
|
|
585
588
|
methodInvocationSuffix(ctx, params) {
|
|
586
|
-
if (ctx.argumentList === undefined) {
|
|
587
|
-
return rejectAndConcat([ctx.LBrace[0], ctx.RBrace[0]]);
|
|
588
|
-
}
|
|
589
|
-
|
|
590
589
|
const argumentList = this.visit(ctx.argumentList);
|
|
591
590
|
if (params && params.shouldDedent) {
|
|
592
591
|
return dedent(
|