prettier-plugin-java
Advanced tools
Comparing version 1.4.0 to 1.5.0
@@ -29,2 +29,4 @@ "use strict"; | ||
{ value: "switchLabel" }, | ||
{ value: "caseOrDefaultLabel" }, | ||
{ value: "caseLabelElement" }, | ||
{ value: "switchRule" }, | ||
@@ -31,0 +33,0 @@ { value: "caseConstant" }, |
@@ -184,16 +184,22 @@ "use strict"; | ||
BlocksAndStatementPrettierVisitor.prototype.switchBlockStatementGroup = function (ctx) { | ||
var switchLabels = this.mapVisit(ctx.switchLabel); | ||
var labels = []; | ||
for (var i = 0; i < switchLabels.length; i++) { | ||
labels.push(prettier_builder_1.concat([switchLabels[i], ctx.Colon[i]])); | ||
} | ||
var switchLabel = this.visit(ctx.switchLabel); | ||
var blockStatements = this.visit(ctx.blockStatements); | ||
return prettier_builder_1.indent(printer_utils_1.rejectAndJoin(hardline, [ | ||
prettier_builder_1.dedent(printer_utils_1.rejectAndJoin(hardline, labels)), | ||
blockStatements | ||
])); | ||
return prettier_builder_1.concat([ | ||
switchLabel, | ||
ctx.Colon[0], | ||
blockStatements && prettier_builder_1.indent([hardline, blockStatements]) | ||
]); | ||
}; | ||
BlocksAndStatementPrettierVisitor.prototype.switchLabel = function (ctx) { | ||
var caseOrDefaultLabels = this.mapVisit(ctx.caseOrDefaultLabel); | ||
var colons = ctx.Colon | ||
? ctx.Colon.map(function (elt) { | ||
return prettier_builder_1.concat([elt, hardline]); | ||
}) | ||
: []; | ||
return prettier_builder_1.group(printer_utils_1.rejectAndJoinSeps(colons, caseOrDefaultLabels)); | ||
}; | ||
BlocksAndStatementPrettierVisitor.prototype.caseOrDefaultLabel = function (ctx) { | ||
if (ctx.Case) { | ||
var caseConstants = this.mapVisit(ctx.caseConstant); | ||
var caseLabelElements = this.mapVisit(ctx.caseLabelElement); | ||
var commas = ctx.Comma | ||
@@ -206,3 +212,3 @@ ? ctx.Comma.map(function (elt) { | ||
prettier_builder_1.concat([ctx.Case[0], " "]), | ||
printer_utils_1.rejectAndJoinSeps(commas, caseConstants) | ||
printer_utils_1.rejectAndJoinSeps(commas, caseLabelElements) | ||
]))); | ||
@@ -212,2 +218,8 @@ } | ||
}; | ||
BlocksAndStatementPrettierVisitor.prototype.caseLabelElement = function (ctx) { | ||
if (ctx.Default || ctx.Null) { | ||
return this.getSingle(ctx); | ||
} | ||
return this.visitSingle(ctx); | ||
}; | ||
BlocksAndStatementPrettierVisitor.prototype.switchRule = function (ctx) { | ||
@@ -214,0 +226,0 @@ var switchLabel = this.visit(ctx.switchLabel); |
@@ -107,8 +107,8 @@ "use strict"; | ||
var typeParameterList = this.visit(ctx.typeParameterList); | ||
return printer_utils_1.rejectAndConcat([ctx.Less[0], typeParameterList, ctx.Greater[0]]); | ||
return printer_utils_1.putIntoBraces(typeParameterList, softline, ctx.Less[0], ctx.Greater[0]); | ||
}; | ||
ClassesPrettierVisitor.prototype.typeParameterList = function (ctx) { | ||
var typeParameter = this.mapVisit(ctx.typeParameter); | ||
var commas = ctx.Comma ? ctx.Comma.map(function (elt) { return prettier_builder_1.concat([elt, " "]); }) : []; | ||
return printer_utils_1.rejectAndJoinSeps(commas, typeParameter); | ||
var commas = ctx.Comma ? ctx.Comma.map(function (elt) { return prettier_builder_1.concat([elt, line]); }) : []; | ||
return prettier_builder_1.group(printer_utils_1.rejectAndJoinSeps(commas, typeParameter)); | ||
}; | ||
@@ -651,3 +651,3 @@ ClassesPrettierVisitor.prototype.superclass = function (ctx) { | ||
var recordComponents = this.mapVisit(ctx.recordComponent); | ||
var commas = ctx.Comma ? ctx.Comma.map(function (elt) { return prettier_builder_1.concat([elt, " "]); }) : []; | ||
var commas = ctx.Comma ? ctx.Comma.map(function (elt) { return prettier_builder_1.concat([elt, line]); }) : []; | ||
return printer_utils_1.rejectAndJoinSeps(commas, recordComponents); | ||
@@ -654,0 +654,0 @@ }; |
{ | ||
"name": "prettier-plugin-java", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "Prettier Java Plugin", | ||
@@ -12,3 +12,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"java-parser": "1.4.0", | ||
"java-parser": "2.0.0", | ||
"lodash": "4.17.21", | ||
@@ -46,3 +46,3 @@ "prettier": "2.3.1" | ||
}, | ||
"gitHead": "ccc76f65f711ad5be7a7980077e1bfcb54d0571d" | ||
"gitHead": "a9fe7da3d13d0c8a4b74dc6623f3b388fc2aade4" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
200926
3964
0
+ Addedjava-parser@2.0.0(transitive)
- Removedjava-parser@1.4.0(transitive)
Updatedjava-parser@2.0.0