prettier-plugin-java 1.5.0 → 1.6.0
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/dist/printers/classes.js
CHANGED
|
@@ -647,30 +647,34 @@ var ClassesPrettierVisitor = /** @class */ (function (_super) {
|
|
|
647
647
|
};
|
|
648
648
|
ClassesPrettierVisitor.prototype.recordComponentList = function (ctx) {
|
|
649
649
|
var recordComponents = this.mapVisit(ctx.recordComponent);
|
|
650
|
-
var
|
|
650
|
+
var blankLineSeparators = printer_utils_1.getBlankLinesSeparator(ctx.recordComponent, line);
|
|
651
|
+
var commas = ctx.Comma
|
|
652
|
+
? ctx.Comma.map(function (elt, index) {
|
|
653
|
+
return prettier_builder_1.concat([elt, blankLineSeparators[index]]);
|
|
654
|
+
})
|
|
655
|
+
: [];
|
|
651
656
|
return printer_utils_1.rejectAndJoinSeps(commas, recordComponents);
|
|
652
657
|
};
|
|
653
658
|
ClassesPrettierVisitor.prototype.recordComponent = function (ctx) {
|
|
654
659
|
var modifiers = this.mapVisit(ctx.recordComponentModifier);
|
|
655
660
|
var unannType = this.visit(ctx.unannType);
|
|
656
661
|
if (ctx.Identifier !== undefined) {
|
|
657
|
-
return printer_utils_1.rejectAndJoin(
|
|
658
|
-
prettier_builder_1.join(
|
|
659
|
-
unannType,
|
|
660
|
-
|
|
661
|
-
]);
|
|
662
|
+
return prettier_builder_1.group(printer_utils_1.rejectAndJoin(line, [
|
|
663
|
+
prettier_builder_1.join(line, modifiers),
|
|
664
|
+
prettier_builder_1.join(" ", [unannType, ctx.Identifier[0]])
|
|
665
|
+
]));
|
|
662
666
|
}
|
|
663
667
|
var variableArityRecordComponent = this.visit(ctx.variableArityRecordComponent);
|
|
664
668
|
if (ctx.variableArityRecordComponent[0].children.annotation !== undefined) {
|
|
665
|
-
return printer_utils_1.rejectAndJoin(
|
|
666
|
-
prettier_builder_1.join(
|
|
669
|
+
return prettier_builder_1.group(printer_utils_1.rejectAndJoin(line, [
|
|
670
|
+
prettier_builder_1.join(line, modifiers),
|
|
667
671
|
prettier_builder_1.join(" ", [unannType, variableArityRecordComponent])
|
|
668
|
-
]);
|
|
672
|
+
]));
|
|
669
673
|
}
|
|
670
|
-
return printer_utils_1.rejectAndJoin(
|
|
671
|
-
prettier_builder_1.join(
|
|
674
|
+
return prettier_builder_1.group(printer_utils_1.rejectAndJoin(line, [
|
|
675
|
+
prettier_builder_1.join(line, modifiers),
|
|
672
676
|
prettier_builder_1.concat([unannType, variableArityRecordComponent])
|
|
673
|
-
]);
|
|
677
|
+
]));
|
|
674
678
|
};
|
|
675
679
|
ClassesPrettierVisitor.prototype.variableArityRecordComponent = function (ctx) {
|
|
676
680
|
var annotations = this.mapVisit(ctx.annotation);
|
|
@@ -399,13 +399,13 @@ var ExpressionsPrettierVisitor = /** @class */ (function (_super) {
|
|
|
399
399
|
};
|
|
400
400
|
ExpressionsPrettierVisitor.prototype.referenceTypeCastExpression = function (ctx) {
|
|
401
401
|
var referenceType = this.visit(ctx.referenceType);
|
|
402
|
-
var
|
|
402
|
+
var hasAdditionalBounds = ctx.additionalBound !== undefined;
|
|
403
|
+
var additionalBounds = printer_utils_1.rejectAndJoin(line, this.mapVisit(ctx.additionalBound));
|
|
403
404
|
var expression = ctx.lambdaExpression
|
|
404
405
|
? this.visit(ctx.lambdaExpression)
|
|
405
406
|
: this.visit(ctx.unaryExpressionNotPlusMinus);
|
|
406
407
|
return printer_utils_1.rejectAndJoin(" ", [
|
|
407
|
-
printer_utils_1.
|
|
408
|
-
additionalBound,
|
|
408
|
+
printer_utils_1.putIntoBraces(printer_utils_1.rejectAndJoin(line, [referenceType, additionalBounds]), hasAdditionalBounds ? softline : "", ctx.LBrace[0], ctx.RBrace[0]),
|
|
409
409
|
expression
|
|
410
410
|
]);
|
|
411
411
|
};
|
|
@@ -259,7 +259,8 @@ function isExplicitLambdaParameter(ctx) {
|
|
|
259
259
|
ctx.lambdaParameterList[0].children.explicitLambdaParameterList);
|
|
260
260
|
}
|
|
261
261
|
exports.isExplicitLambdaParameter = isExplicitLambdaParameter;
|
|
262
|
-
function getBlankLinesSeparator(ctx) {
|
|
262
|
+
function getBlankLinesSeparator(ctx, separator) {
|
|
263
|
+
if (separator === void 0) { separator = hardline; }
|
|
263
264
|
if (ctx === undefined) {
|
|
264
265
|
return undefined;
|
|
265
266
|
}
|
|
@@ -277,7 +278,7 @@ function getBlankLinesSeparator(ctx) {
|
|
|
277
278
|
separators.push(prettier_builder_1.concat([hardline, hardline]));
|
|
278
279
|
}
|
|
279
280
|
else {
|
|
280
|
-
separators.push(
|
|
281
|
+
separators.push(separator);
|
|
281
282
|
}
|
|
282
283
|
}
|
|
283
284
|
return separators;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prettier-plugin-java",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Prettier Java Plugin",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"ts-node": "10.2.1",
|
|
43
43
|
"typescript": "4.3.5"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "650080c029302cf309d7f7ea65d58824527a7188"
|
|
46
46
|
}
|