prettier-plugin-java
Advanced tools
Comparing version 2.3.1 to 2.4.0
@@ -174,4 +174,6 @@ "use strict"; | ||
{ value: "pattern" }, | ||
{ value: "primaryPattern" }, | ||
{ value: "typePattern" }, | ||
{ value: "recordPattern" }, | ||
{ value: "patternList" }, | ||
{ value: "guard" }, | ||
{ value: "identifyNewExpressionType" }, | ||
@@ -178,0 +180,0 @@ { value: "isLambdaExpression" }, |
@@ -224,3 +224,8 @@ "use strict"; | ||
} | ||
return this.visitSingle(ctx); | ||
else if (ctx.pattern) { | ||
var pattern = this.visit(ctx.pattern); | ||
var guard = this.visit(ctx.guard); | ||
return (0, printer_utils_1.rejectAndJoin)(" ", [(0, prettier_builder_1.dedent)(pattern), guard]); | ||
} | ||
return this.visit(ctx.caseConstant); | ||
}; | ||
@@ -239,3 +244,3 @@ BlocksAndStatementPrettierVisitor.prototype.switchRule = function (ctx) { | ||
} | ||
return (0, prettier_builder_1.join)(" ", [switchLabel, ctx.Arrow[0], caseInstruction]); | ||
return (0, prettier_builder_1.concat)([switchLabel, " ", ctx.Arrow[0], " ", caseInstruction]); | ||
}; | ||
@@ -242,0 +247,0 @@ BlocksAndStatementPrettierVisitor.prototype.caseConstant = function (ctx) { |
@@ -506,25 +506,27 @@ "use strict"; | ||
ExpressionsPrettierVisitor.prototype.pattern = function (ctx) { | ||
var primaryPattern = this.visit(ctx.primaryPattern); | ||
if (ctx.AndAnd === undefined) { | ||
return primaryPattern; | ||
} | ||
var binaryExpression = this.visit(ctx.binaryExpression); | ||
return (0, printer_utils_1.rejectAndConcat)([ | ||
primaryPattern, | ||
" ", | ||
ctx.AndAnd[0], | ||
line, | ||
binaryExpression | ||
]); | ||
return this.visitSingle(ctx); | ||
}; | ||
ExpressionsPrettierVisitor.prototype.primaryPattern = function (ctx) { | ||
if (ctx.LBrace === undefined) { | ||
return this.visitSingle(ctx); | ||
} | ||
var pattern = this.visit(ctx.pattern); | ||
return (0, printer_utils_1.putIntoBraces)(pattern, softline, ctx.LBrace[0], ctx.RBrace[0]); | ||
}; | ||
ExpressionsPrettierVisitor.prototype.typePattern = function (ctx) { | ||
return this.visitSingle(ctx); | ||
}; | ||
ExpressionsPrettierVisitor.prototype.recordPattern = function (ctx) { | ||
var referenceType = this.visit(ctx.referenceType); | ||
var patternList = this.visit(ctx.patternList); | ||
return (0, prettier_builder_1.concat)([ | ||
referenceType, | ||
(0, printer_utils_1.putIntoBraces)(patternList, softline, ctx.LBrace[0], ctx.RBrace[0]) | ||
]); | ||
}; | ||
ExpressionsPrettierVisitor.prototype.patternList = function (ctx) { | ||
var _a, _b; | ||
var patterns = this.mapVisit(ctx.pattern); | ||
var commas = (_b = (_a = ctx.Comma) === null || _a === void 0 ? void 0 : _a.map(function (elt) { return (0, prettier_builder_1.concat)([elt, line]); })) !== null && _b !== void 0 ? _b : []; | ||
return (0, printer_utils_1.rejectAndJoinSeps)(commas, patterns); | ||
}; | ||
ExpressionsPrettierVisitor.prototype.guard = function (ctx) { | ||
var expression = this.visit(ctx.expression, { | ||
addParenthesisToWrapStatement: true | ||
}); | ||
return (0, prettier_builder_1.concat)([ctx.When[0], " ", (0, prettier_builder_1.dedent)(expression)]); | ||
}; | ||
ExpressionsPrettierVisitor.prototype.identifyNewExpressionType = function () { | ||
@@ -531,0 +533,0 @@ return "identifyNewExpressionType"; |
{ | ||
"name": "prettier-plugin-java", | ||
"version": "2.3.1", | ||
"version": "2.4.0", | ||
"description": "Prettier Java Plugin", | ||
@@ -12,3 +12,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"java-parser": "2.0.5", | ||
"java-parser": "2.1.0", | ||
"lodash": "4.17.21", | ||
@@ -45,3 +45,3 @@ "prettier": "3.0.3" | ||
}, | ||
"gitHead": "a7f9a5f795a87ccfd7910118b0856b449dedb957" | ||
"gitHead": "acdd5e7f28d08c4fb0351cfaf43d4ff9524b90ba" | ||
} |
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
473813
9840
+ Addedjava-parser@2.1.0(transitive)
- Removedjava-parser@2.0.5(transitive)
Updatedjava-parser@2.1.0