prettier-plugin-java 1.4.0 → 1.5.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/options.js
CHANGED
|
@@ -26,6 +26,8 @@ module.exports = {
|
|
|
26
26
|
{ value: "switchBlock" },
|
|
27
27
|
{ value: "switchBlockStatementGroup" },
|
|
28
28
|
{ value: "switchLabel" },
|
|
29
|
+
{ value: "caseOrDefaultLabel" },
|
|
30
|
+
{ value: "caseLabelElement" },
|
|
29
31
|
{ value: "switchRule" },
|
|
30
32
|
{ value: "caseConstant" },
|
|
31
33
|
{ value: "whileStatement" },
|
|
@@ -181,20 +181,26 @@ var BlocksAndStatementPrettierVisitor = /** @class */ (function (_super) {
|
|
|
181
181
|
return printer_utils_1.putIntoBraces(printer_utils_1.rejectAndJoin(hardline, switchCases), hardline, ctx.LCurly[0], ctx.RCurly[0]);
|
|
182
182
|
};
|
|
183
183
|
BlocksAndStatementPrettierVisitor.prototype.switchBlockStatementGroup = function (ctx) {
|
|
184
|
-
var
|
|
185
|
-
var labels = [];
|
|
186
|
-
for (var i = 0; i < switchLabels.length; i++) {
|
|
187
|
-
labels.push(prettier_builder_1.concat([switchLabels[i], ctx.Colon[i]]));
|
|
188
|
-
}
|
|
184
|
+
var switchLabel = this.visit(ctx.switchLabel);
|
|
189
185
|
var blockStatements = this.visit(ctx.blockStatements);
|
|
190
|
-
return prettier_builder_1.
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
186
|
+
return prettier_builder_1.concat([
|
|
187
|
+
switchLabel,
|
|
188
|
+
ctx.Colon[0],
|
|
189
|
+
blockStatements && prettier_builder_1.indent([hardline, blockStatements])
|
|
190
|
+
]);
|
|
194
191
|
};
|
|
195
192
|
BlocksAndStatementPrettierVisitor.prototype.switchLabel = function (ctx) {
|
|
193
|
+
var caseOrDefaultLabels = this.mapVisit(ctx.caseOrDefaultLabel);
|
|
194
|
+
var colons = ctx.Colon
|
|
195
|
+
? ctx.Colon.map(function (elt) {
|
|
196
|
+
return prettier_builder_1.concat([elt, hardline]);
|
|
197
|
+
})
|
|
198
|
+
: [];
|
|
199
|
+
return prettier_builder_1.group(printer_utils_1.rejectAndJoinSeps(colons, caseOrDefaultLabels));
|
|
200
|
+
};
|
|
201
|
+
BlocksAndStatementPrettierVisitor.prototype.caseOrDefaultLabel = function (ctx) {
|
|
196
202
|
if (ctx.Case) {
|
|
197
|
-
var
|
|
203
|
+
var caseLabelElements = this.mapVisit(ctx.caseLabelElement);
|
|
198
204
|
var commas = ctx.Comma
|
|
199
205
|
? ctx.Comma.map(function (elt) {
|
|
200
206
|
return prettier_builder_1.concat([elt, line]);
|
|
@@ -202,11 +208,17 @@ var BlocksAndStatementPrettierVisitor = /** @class */ (function (_super) {
|
|
|
202
208
|
: [];
|
|
203
209
|
return prettier_builder_1.group(prettier_builder_1.indent(printer_utils_1.rejectAndConcat([
|
|
204
210
|
prettier_builder_1.concat([ctx.Case[0], " "]),
|
|
205
|
-
printer_utils_1.rejectAndJoinSeps(commas,
|
|
211
|
+
printer_utils_1.rejectAndJoinSeps(commas, caseLabelElements)
|
|
206
212
|
])));
|
|
207
213
|
}
|
|
208
214
|
return prettier_builder_1.concat([ctx.Default[0]]);
|
|
209
215
|
};
|
|
216
|
+
BlocksAndStatementPrettierVisitor.prototype.caseLabelElement = function (ctx) {
|
|
217
|
+
if (ctx.Default || ctx.Null) {
|
|
218
|
+
return this.getSingle(ctx);
|
|
219
|
+
}
|
|
220
|
+
return this.visitSingle(ctx);
|
|
221
|
+
};
|
|
210
222
|
BlocksAndStatementPrettierVisitor.prototype.switchRule = function (ctx) {
|
|
211
223
|
var switchLabel = this.visit(ctx.switchLabel);
|
|
212
224
|
var caseInstruction;
|
package/dist/printers/classes.js
CHANGED
|
@@ -104,12 +104,12 @@ var ClassesPrettierVisitor = /** @class */ (function (_super) {
|
|
|
104
104
|
};
|
|
105
105
|
ClassesPrettierVisitor.prototype.typeParameters = function (ctx) {
|
|
106
106
|
var typeParameterList = this.visit(ctx.typeParameterList);
|
|
107
|
-
return printer_utils_1.
|
|
107
|
+
return printer_utils_1.putIntoBraces(typeParameterList, softline, ctx.Less[0], ctx.Greater[0]);
|
|
108
108
|
};
|
|
109
109
|
ClassesPrettierVisitor.prototype.typeParameterList = function (ctx) {
|
|
110
110
|
var typeParameter = this.mapVisit(ctx.typeParameter);
|
|
111
|
-
var commas = ctx.Comma ? ctx.Comma.map(function (elt) { return prettier_builder_1.concat([elt,
|
|
112
|
-
return printer_utils_1.rejectAndJoinSeps(commas, typeParameter);
|
|
111
|
+
var commas = ctx.Comma ? ctx.Comma.map(function (elt) { return prettier_builder_1.concat([elt, line]); }) : [];
|
|
112
|
+
return prettier_builder_1.group(printer_utils_1.rejectAndJoinSeps(commas, typeParameter));
|
|
113
113
|
};
|
|
114
114
|
ClassesPrettierVisitor.prototype.superclass = function (ctx) {
|
|
115
115
|
return prettier_builder_1.join(" ", [ctx.Extends[0], this.visit(ctx.classType)]);
|
|
@@ -647,7 +647,7 @@ var ClassesPrettierVisitor = /** @class */ (function (_super) {
|
|
|
647
647
|
};
|
|
648
648
|
ClassesPrettierVisitor.prototype.recordComponentList = function (ctx) {
|
|
649
649
|
var recordComponents = this.mapVisit(ctx.recordComponent);
|
|
650
|
-
var commas = ctx.Comma ? ctx.Comma.map(function (elt) { return prettier_builder_1.concat([elt,
|
|
650
|
+
var commas = ctx.Comma ? ctx.Comma.map(function (elt) { return prettier_builder_1.concat([elt, line]); }) : [];
|
|
651
651
|
return printer_utils_1.rejectAndJoinSeps(commas, recordComponents);
|
|
652
652
|
};
|
|
653
653
|
ClassesPrettierVisitor.prototype.recordComponent = function (ctx) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prettier-plugin-java",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Prettier Java Plugin",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"repository": "https://github.com/jhipster/prettier-java",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"java-parser": "
|
|
12
|
+
"java-parser": "2.0.0",
|
|
13
13
|
"lodash": "4.17.21",
|
|
14
14
|
"prettier": "2.3.1"
|
|
15
15
|
},
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"ts-node": "10.2.1",
|
|
43
43
|
"typescript": "4.3.5"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "a9fe7da3d13d0c8a4b74dc6623f3b388fc2aade4"
|
|
46
46
|
}
|