prettier-plugin-java 1.6.2 → 2.0.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/base-cst-printer.js +4 -3
- package/dist/cst-printer.js +1 -0
- package/dist/index.js +1 -0
- package/dist/options.js +2 -0
- package/dist/parser.js +1 -0
- package/dist/printer.js +1 -0
- package/dist/printers/arrays.js +4 -3
- package/dist/printers/blocks-and-statements.js +107 -102
- package/dist/printers/classes.js +152 -151
- package/dist/printers/comments/comments-utils.js +1 -0
- package/dist/printers/comments/format-comments.js +22 -13
- package/dist/printers/comments/handle-comments.js +2 -1
- package/dist/printers/expressions.js +128 -105
- package/dist/printers/interfaces.js +57 -56
- package/dist/printers/lexical-structure.js +5 -4
- package/dist/printers/names.js +9 -8
- package/dist/printers/packages-and-modules.js +73 -59
- package/dist/printers/prettier-builder.js +21 -12
- package/dist/printers/printer-utils.js +64 -56
- package/dist/printers/types-values-and-variables.js +44 -39
- package/dist/src/base-cst-printer.js +77 -0
- package/dist/src/cst-printer.js +37 -0
- package/dist/src/index.js +67 -0
- package/dist/src/options.js +256 -0
- package/dist/src/parser.js +7 -0
- package/dist/src/printer.js +28 -0
- package/dist/src/printers/arrays.js +49 -0
- package/dist/src/printers/blocks-and-statements.js +493 -0
- package/dist/src/printers/classes.js +724 -0
- package/dist/src/printers/comments/comments-utils.js +29 -0
- package/dist/src/printers/comments/format-comments.js +187 -0
- package/dist/src/printers/comments/handle-comments.js +38 -0
- package/dist/src/printers/expressions.js +549 -0
- package/dist/src/printers/interfaces.js +251 -0
- package/dist/src/printers/lexical-structure.js +43 -0
- package/dist/src/printers/names.js +53 -0
- package/dist/src/printers/packages-and-modules.js +185 -0
- package/dist/src/printers/prettier-builder.js +47 -0
- package/dist/src/printers/printer-utils.js +577 -0
- package/dist/src/printers/types-values-and-variables.js +183 -0
- package/dist/src/types/utils.js +29 -0
- package/dist/src/utils/expressions-utils.js +29 -0
- package/dist/src/utils/index.js +10 -0
- package/dist/src/utils/printArgumentListWithBraces.js +21 -0
- package/dist/src/utils/printSingleLambdaInvocation.js +20 -0
- package/dist/test/babel-register.js +3 -0
- package/dist/test/repository-test/core-test.js +12 -0
- package/dist/test/repository-test/jhipster-1-test.js +17 -0
- package/dist/test/repository-test/jhipster-2-test.js +16 -0
- package/dist/test/test-utils.js +215 -0
- package/dist/test/unit-test/annotation_type_declaration/annotation_type_declaration-spec.js +6 -0
- package/dist/test/unit-test/args/args-spec.js +6 -0
- package/dist/test/unit-test/assert/assert-spec.js +6 -0
- package/dist/test/unit-test/binary_expressions/binary_expressions-spec.js +6 -0
- package/dist/test/unit-test/blank_lines/blank_lines-spec.js +6 -0
- package/dist/test/unit-test/bug-fixes/bug-fixes-spec.js +6 -0
- package/dist/test/unit-test/cast/cast-spec.js +6 -0
- package/dist/test/unit-test/char_literal/char_literal-spec.js +6 -0
- package/dist/test/unit-test/classes/multiple_classes-spec.js +6 -0
- package/dist/test/unit-test/comments/comments-spec.js +14 -0
- package/dist/test/unit-test/complex_generic_class/complex_generic_class-spec.js +6 -0
- package/dist/test/unit-test/constructors/constructors-spec.js +6 -0
- package/dist/test/unit-test/empty_statement/empty_statement-spec.js +6 -0
- package/dist/test/unit-test/enum/enum-spec.js +6 -0
- package/dist/test/unit-test/expressions/expressions-spec.js +6 -0
- package/dist/test/unit-test/extends_abstract_class/extends_abstract_class-spec.js +6 -0
- package/dist/test/unit-test/extends_abstract_class_and_implements_interfaces/extends_abstract_class_and_implements_interfaces-spec.js +6 -0
- package/dist/test/unit-test/for/for-spec.js +6 -0
- package/dist/test/unit-test/generic_class/generic_class-spec.js +6 -0
- package/dist/test/unit-test/generic_questionmark/generic_questionmark-spec.js +6 -0
- package/dist/test/unit-test/hello-world/hello-word-spec.js +6 -0
- package/dist/test/unit-test/if/if-spec.js +6 -0
- package/dist/test/unit-test/indent/indent-spec.js +6 -0
- package/dist/test/unit-test/instantiation/instantiation-spec.js +6 -0
- package/dist/test/unit-test/interface/interface-spec.js +6 -0
- package/dist/test/unit-test/lambda/lambda-spec.js +6 -0
- package/dist/test/unit-test/marker_annotations/marker_annotations-spec.js +6 -0
- package/dist/test/unit-test/member_chain/member_chain-spec.js +6 -0
- package/dist/test/unit-test/method_reference/method_reference-spec.js +6 -0
- package/dist/test/unit-test/modifiers/modifiers-spec.js +6 -0
- package/dist/test/unit-test/modules/modules-spec.js +6 -0
- package/dist/test/unit-test/package_and_imports/package_and_imports-spec.js +34 -0
- package/dist/test/unit-test/pattern-matching/pattern-matching-spec.js +6 -0
- package/dist/test/unit-test/prettier-ignore/prettier-ignore-spec.js +28 -0
- package/dist/test/unit-test/records/records-spec.js +6 -0
- package/dist/test/unit-test/return/return-spec.js +6 -0
- package/dist/test/unit-test/sealed/sealed-spec.js +6 -0
- package/dist/test/unit-test/snippets/arrays/array-initializer.spec.js +94 -0
- package/dist/test/unit-test/snippets/arrays/variable-initializer-list.spec.js +19 -0
- package/dist/test/unit-test/snippets/blocks-and-statements/switch.spec.js +26 -0
- package/dist/test/unit-test/snippets/classes/class-body.spec.js +181 -0
- package/dist/test/unit-test/snippets/classes/enum-body.spec.js +87 -0
- package/dist/test/unit-test/snippets/classes/variableDeclarator/test.spec.js +186 -0
- package/dist/test/unit-test/snippets/interfaces/element-value-array-initializer.spec.js +85 -0
- package/dist/test/unit-test/snippets/names/ambiguousName/test.spec.js +19 -0
- package/dist/test/unit-test/snippets/names/expressionName/test.spec.js +19 -0
- package/dist/test/unit-test/snippets/names/methodName/test.spec.js +12 -0
- package/dist/test/unit-test/snippets/names/packageOrTypeName/test.spec.js +19 -0
- package/dist/test/unit-test/snippets/types-values-and-variables/floatingPointType/test.spec.js +19 -0
- package/dist/test/unit-test/snippets/types-values-and-variables/integralType/test.spec.js +40 -0
- package/dist/test/unit-test/snippets/types-values-and-variables/numericType/test.spec.js +88 -0
- package/dist/test/unit-test/snippets/types-values-and-variables/wildcard/test.spec.js +112 -0
- package/dist/test/unit-test/snippets/types-values-and-variables/wildcardBounds/test.spec.js +81 -0
- package/dist/test/unit-test/switch/switch-spec.js +6 -0
- package/dist/test/unit-test/synchronized/synchronized-spec.js +6 -0
- package/dist/test/unit-test/text-blocks/text-block-spec.js +6 -0
- package/dist/test/unit-test/throws/throws-spec.js +6 -0
- package/dist/test/unit-test/try_catch/try_catch-spec.js +6 -0
- package/dist/test/unit-test/types/types-spec.js +6 -0
- package/dist/test/unit-test/variables/variables-spec.js +6 -0
- package/dist/test/unit-test/while/while-spec.js +6 -0
- package/dist/test/unit-test/yield-statement/yield-statement-spec.js +6 -0
- package/dist/types/utils.js +1 -0
- package/dist/utils/expressions-utils.js +1 -0
- package/dist/utils/index.js +4 -1
- package/dist/utils/isEmptyDoc.js +7 -0
- package/dist/utils/printArgumentListWithBraces.js +3 -2
- package/dist/utils/printSingleLambdaInvocation.js +5 -4
- package/package.json +21 -21
- package/dist/utils/constants.js +0 -4
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
var base_cst_printer_1 = require("../../../../../src/base-cst-printer");
|
|
40
|
+
var sinon_1 = require("sinon");
|
|
41
|
+
var test_utils_1 = require("../../../../test-utils");
|
|
42
|
+
describe("Wildcard", function () {
|
|
43
|
+
var wildcardBoundsSpy;
|
|
44
|
+
// eslint-disable-next-line no-undef
|
|
45
|
+
beforeEach(function () {
|
|
46
|
+
if (wildcardBoundsSpy !== undefined) {
|
|
47
|
+
wildcardBoundsSpy.restore();
|
|
48
|
+
}
|
|
49
|
+
wildcardBoundsSpy = sinon_1.spy(base_cst_printer_1.BaseCstPrettierPrinter.prototype, "wildcardBounds");
|
|
50
|
+
});
|
|
51
|
+
it("can format a wildcard", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
52
|
+
return __generator(this, function (_a) {
|
|
53
|
+
switch (_a.label) {
|
|
54
|
+
case 0: return [4 /*yield*/, test_utils_1.expectSnippetToBeFormatted({
|
|
55
|
+
snippet: "?",
|
|
56
|
+
expectedOutput: "?",
|
|
57
|
+
entryPoint: "wildcard"
|
|
58
|
+
})];
|
|
59
|
+
case 1:
|
|
60
|
+
_a.sent();
|
|
61
|
+
return [2 /*return*/];
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}); });
|
|
65
|
+
it("can format a wildcard with one annotations", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
66
|
+
return __generator(this, function (_a) {
|
|
67
|
+
switch (_a.label) {
|
|
68
|
+
case 0: return [4 /*yield*/, test_utils_1.expectSnippetToBeFormatted({
|
|
69
|
+
snippet: "@Anno ?",
|
|
70
|
+
expectedOutput: "@Anno ?",
|
|
71
|
+
entryPoint: "wildcard"
|
|
72
|
+
})];
|
|
73
|
+
case 1:
|
|
74
|
+
_a.sent();
|
|
75
|
+
return [2 /*return*/];
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}); });
|
|
79
|
+
it("can format a wildcard with annotations that exceed printWidth ", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
80
|
+
var snippet, expectedOutput;
|
|
81
|
+
return __generator(this, function (_a) {
|
|
82
|
+
switch (_a.label) {
|
|
83
|
+
case 0:
|
|
84
|
+
snippet = "@Annotation1 @Annotation2 @Annotation3 @Annotation4 @Annotation5 @Annotation6 @Annotation7 ?";
|
|
85
|
+
expectedOutput = "@Annotation1 @Annotation2 @Annotation3 @Annotation4 @Annotation5 @Annotation6 @Annotation7 ?";
|
|
86
|
+
return [4 /*yield*/, test_utils_1.expectSnippetToBeFormatted({
|
|
87
|
+
snippet: snippet,
|
|
88
|
+
expectedOutput: expectedOutput,
|
|
89
|
+
entryPoint: "wildcard"
|
|
90
|
+
})];
|
|
91
|
+
case 1:
|
|
92
|
+
_a.sent();
|
|
93
|
+
return [2 /*return*/];
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}); });
|
|
97
|
+
it("can format a wildcard with wildcardBound", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
98
|
+
return __generator(this, function (_a) {
|
|
99
|
+
switch (_a.label) {
|
|
100
|
+
case 0: return [4 /*yield*/, test_utils_1.expectSnippetToBeFormatted({
|
|
101
|
+
snippet: "? extends int[]",
|
|
102
|
+
expectedOutput: "? extends int[]",
|
|
103
|
+
entryPoint: "wildcard"
|
|
104
|
+
})];
|
|
105
|
+
case 1:
|
|
106
|
+
_a.sent();
|
|
107
|
+
sinon_1.assert.calledTwice(wildcardBoundsSpy);
|
|
108
|
+
return [2 /*return*/];
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}); });
|
|
112
|
+
});
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
var base_cst_printer_1 = require("../../../../../src/base-cst-printer");
|
|
40
|
+
var sinon_1 = require("sinon");
|
|
41
|
+
var test_utils_1 = require("../../../../test-utils");
|
|
42
|
+
describe("Wildcard Bounds", function () {
|
|
43
|
+
var referenceTypeSpy;
|
|
44
|
+
// eslint-disable-next-line no-undef
|
|
45
|
+
beforeEach(function () {
|
|
46
|
+
if (referenceTypeSpy !== undefined) {
|
|
47
|
+
referenceTypeSpy.restore();
|
|
48
|
+
}
|
|
49
|
+
referenceTypeSpy = sinon_1.spy(base_cst_printer_1.BaseCstPrettierPrinter.prototype, "referenceType");
|
|
50
|
+
});
|
|
51
|
+
it("can format a wildcardBounds with extends", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
52
|
+
return __generator(this, function (_a) {
|
|
53
|
+
switch (_a.label) {
|
|
54
|
+
case 0: return [4 /*yield*/, test_utils_1.expectSnippetToBeFormatted({
|
|
55
|
+
snippet: "extends int[]",
|
|
56
|
+
expectedOutput: "extends int[]",
|
|
57
|
+
entryPoint: "wildcardBounds"
|
|
58
|
+
})];
|
|
59
|
+
case 1:
|
|
60
|
+
_a.sent();
|
|
61
|
+
sinon_1.assert.callCount(referenceTypeSpy, 2);
|
|
62
|
+
return [2 /*return*/];
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}); });
|
|
66
|
+
it("can format a wildcardBounds with super", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
67
|
+
return __generator(this, function (_a) {
|
|
68
|
+
switch (_a.label) {
|
|
69
|
+
case 0: return [4 /*yield*/, test_utils_1.expectSnippetToBeFormatted({
|
|
70
|
+
snippet: "super int[]",
|
|
71
|
+
expectedOutput: "super int[]",
|
|
72
|
+
entryPoint: "wildcardBounds"
|
|
73
|
+
})];
|
|
74
|
+
case 1:
|
|
75
|
+
_a.sent();
|
|
76
|
+
sinon_1.assert.callCount(referenceTypeSpy, 2);
|
|
77
|
+
return [2 /*return*/];
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}); });
|
|
81
|
+
});
|
package/dist/types/utils.js
CHANGED
|
@@ -27,3 +27,4 @@ var isOrdinaryCompilationUnitCtx = function (ctx) {
|
|
|
27
27
|
undefined);
|
|
28
28
|
};
|
|
29
29
|
exports.isOrdinaryCompilationUnitCtx = isOrdinaryCompilationUnitCtx;
|
|
30
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdHlwZXMvdXRpbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBVUEsU0FBZ0IsU0FBUyxDQUFDLFdBQXVCO0lBQy9DLE9BQU8sQ0FBQyxRQUFRLENBQUMsV0FBVyxDQUFDLENBQUM7QUFDaEMsQ0FBQztBQUZELDhCQUVDO0FBRUQsU0FBZ0IsUUFBUSxDQUFDLFdBQXVCO0lBQzlDLE9BQU8sQ0FDSixXQUFzQixDQUFDLFNBQVMsS0FBSyxTQUFTO1FBQzlDLFdBQXNCLENBQUMsS0FBSyxLQUFLLFNBQVMsQ0FDNUMsQ0FBQztBQUNKLENBQUM7QUFMRCw0QkFLQztBQUVELFNBQWdCLDZCQUE2QixDQUMzQyxXQUFtQztJQUVuQyxPQUFPLFdBQVcsS0FBSyxTQUFTLElBQUksUUFBUSxDQUFDLFdBQVcsQ0FBQyxDQUFDO0FBQzVELENBQUM7QUFKRCxzRUFJQztBQUVNLElBQU0sc0JBQXNCLEdBQUcsVUFDcEMsVUFBc0I7SUFFdEIsT0FBUSxVQUFzQixDQUFDLElBQUksS0FBSyxlQUFlLENBQUM7QUFDMUQsQ0FBQyxDQUFDO0FBSlcsUUFBQSxzQkFBc0IsMEJBSWpDO0FBRUssSUFBTSxtQkFBbUIsR0FBRyxVQUNqQyxVQUFzQjtJQUV0QixPQUFRLFVBQXNCLENBQUMsSUFBSSxLQUFLLFlBQVksQ0FBQztBQUN2RCxDQUFDLENBQUM7QUFKVyxRQUFBLG1CQUFtQix1QkFJOUI7QUFFSyxJQUFNLDRCQUE0QixHQUFHLFVBQzFDLEdBQXVCO0lBRXZCLE9BQU8sQ0FDSixHQUEwQyxDQUFDLHVCQUF1QjtRQUNuRSxTQUFTLENBQ1YsQ0FBQztBQUNKLENBQUMsQ0FBQztBQVBXLFFBQUEsNEJBQTRCLGdDQU92QyJ9
|
|
@@ -27,3 +27,4 @@ var isSingleArgumentLambdaExpressionWithBlock = function (argumentList) {
|
|
|
27
27
|
.block !== undefined);
|
|
28
28
|
};
|
|
29
29
|
exports.isSingleArgumentLambdaExpressionWithBlock = isSingleArgumentLambdaExpressionWithBlock;
|
|
30
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXhwcmVzc2lvbnMtdXRpbHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbHMvZXhwcmVzc2lvbnMtdXRpbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBRUEsU0FBZ0IsMEJBQTBCLENBQ3hDLFlBQStDO0lBRS9DLElBQUksWUFBWSxLQUFLLFNBQVMsRUFBRTtRQUM5QixPQUFPLEtBQUssQ0FBQztLQUNkO0lBRUQsSUFBTSxJQUFJLEdBQUcsWUFBWSxDQUFDLENBQUMsQ0FBQyxDQUFDLFFBQVEsQ0FBQyxVQUFVLENBQUM7SUFDakQsSUFBSSxJQUFJLENBQUMsTUFBTSxLQUFLLENBQUMsRUFBRTtRQUNyQixPQUFPLEtBQUssQ0FBQztLQUNkO0lBRUQsSUFBTSxRQUFRLEdBQUcsSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDO0lBQ3pCLE9BQU8sUUFBUSxDQUFDLFFBQVEsQ0FBQyxnQkFBZ0IsS0FBSyxTQUFTLENBQUM7QUFDMUQsQ0FBQztBQWRELGdFQWNDO0FBRU0sSUFBTSx5Q0FBeUMsR0FBRyxVQUN2RCxZQUErQztJQUUvQyxJQUFJLFlBQVksS0FBSyxTQUFTLEVBQUU7UUFDOUIsT0FBTyxLQUFLLENBQUM7S0FDZDtJQUVELElBQU0sSUFBSSxHQUFHLFlBQVksQ0FBQyxDQUFDLENBQUMsQ0FBQyxRQUFRLENBQUMsVUFBVSxDQUFDO0lBQ2pELElBQUksSUFBSSxDQUFDLE1BQU0sS0FBSyxDQUFDLEVBQUU7UUFDckIsT0FBTyxLQUFLLENBQUM7S0FDZDtJQUVELElBQU0sUUFBUSxHQUFHLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQztJQUN6QixPQUFPLENBQ0wsUUFBUSxDQUFDLFFBQVEsQ0FBQyxnQkFBZ0IsS0FBSyxTQUFTO1FBQ2hELFFBQVEsQ0FBQyxRQUFRLENBQUMsZ0JBQWdCLENBQUMsQ0FBQyxDQUFDLENBQUMsUUFBUSxDQUFDLFVBQVUsQ0FBQyxDQUFDLENBQUMsQ0FBQyxRQUFRO2FBQ2xFLEtBQUssS0FBSyxTQUFTLENBQ3ZCLENBQUM7QUFDSixDQUFDLENBQUM7QUFsQlcsUUFBQSx5Q0FBeUMsNkNBa0JwRCJ9
|
package/dist/utils/index.js
CHANGED
|
@@ -3,8 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.printSingleLambdaInvocation = exports.printArgumentListWithBraces = void 0;
|
|
6
|
+
exports.isEmptyDoc = exports.printSingleLambdaInvocation = exports.printArgumentListWithBraces = void 0;
|
|
7
7
|
var printArgumentListWithBraces_1 = require("./printArgumentListWithBraces");
|
|
8
8
|
Object.defineProperty(exports, "printArgumentListWithBraces", { enumerable: true, get: function () { return __importDefault(printArgumentListWithBraces_1).default; } });
|
|
9
9
|
var printSingleLambdaInvocation_1 = require("./printSingleLambdaInvocation");
|
|
10
10
|
Object.defineProperty(exports, "printSingleLambdaInvocation", { enumerable: true, get: function () { return __importDefault(printSingleLambdaInvocation_1).default; } });
|
|
11
|
+
var isEmptyDoc_1 = require("./isEmptyDoc");
|
|
12
|
+
Object.defineProperty(exports, "isEmptyDoc", { enumerable: true, get: function () { return __importDefault(isEmptyDoc_1).default; } });
|
|
13
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbHMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUEsNkVBQXVGO0FBQTlFLDJKQUFBLE9BQU8sT0FBK0I7QUFDL0MsNkVBQXVGO0FBQTlFLDJKQUFBLE9BQU8sT0FBK0I7QUFDL0MsMkNBQXFEO0FBQTVDLHlIQUFBLE9BQU8sT0FBYyJ9
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var isEmptyDoc = function (argument) {
|
|
4
|
+
return argument === "" || (Array.isArray(argument) && argument.length) === 0;
|
|
5
|
+
};
|
|
6
|
+
exports.default = isEmptyDoc;
|
|
7
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaXNFbXB0eURvYy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9pc0VtcHR5RG9jLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBRUEsSUFBTSxVQUFVLEdBQUcsVUFBQyxRQUFhO0lBQy9CLE9BQU8sUUFBUSxLQUFLLEVBQUUsSUFBSSxDQUFDLEtBQUssQ0FBQyxPQUFPLENBQUMsUUFBUSxDQUFDLElBQUksUUFBUSxDQUFDLE1BQU0sQ0FBQyxLQUFLLENBQUMsQ0FBQztBQUMvRSxDQUFDLENBQUM7QUFFRixrQkFBZSxVQUFVLENBQUMifQ==
|
|
@@ -9,13 +9,14 @@ var printer_utils_1 = require("../printers/printer-utils");
|
|
|
9
9
|
var printSingleLambdaInvocation_1 = __importDefault(require("./printSingleLambdaInvocation"));
|
|
10
10
|
var softline = doc_1.builders.softline;
|
|
11
11
|
function printArgumentListWithBraces(argumentListCtx, rBrace, lBrace) {
|
|
12
|
-
var isSingleLambda = expressions_utils_1.isArgumentListSingleLambda(argumentListCtx);
|
|
12
|
+
var isSingleLambda = (0, expressions_utils_1.isArgumentListSingleLambda)(argumentListCtx);
|
|
13
13
|
if (isSingleLambda) {
|
|
14
14
|
return printSingleLambdaInvocation_1.default.call(this, argumentListCtx, rBrace, lBrace);
|
|
15
15
|
}
|
|
16
16
|
var argumentList = this.visit(argumentListCtx, {
|
|
17
17
|
isInsideMethodInvocationSuffix: true
|
|
18
18
|
});
|
|
19
|
-
return printer_utils_1.putIntoBraces(argumentList, softline, lBrace, rBrace);
|
|
19
|
+
return (0, printer_utils_1.putIntoBraces)(argumentList, softline, lBrace, rBrace);
|
|
20
20
|
}
|
|
21
21
|
exports.default = printArgumentListWithBraces;
|
|
22
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpbnRBcmd1bWVudExpc3RXaXRoQnJhY2VzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3V0aWxzL3ByaW50QXJndW1lbnRMaXN0V2l0aEJyYWNlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUNBLG9DQUF3QztBQUN4Qyx5REFBaUU7QUFDakUsMkRBQTBEO0FBQzFELDhGQUF3RTtBQUVoRSxJQUFBLFFBQVEsR0FBSyxjQUFRLFNBQWIsQ0FBYztBQUU5QixTQUF3QiwyQkFBMkIsQ0FDakQsZUFBa0QsRUFDbEQsTUFBYyxFQUNkLE1BQWM7SUFFZCxJQUFNLGNBQWMsR0FBRyxJQUFBLDhDQUEwQixFQUFDLGVBQWUsQ0FBQyxDQUFDO0lBQ25FLElBQUksY0FBYyxFQUFFO1FBQ2xCLE9BQU8scUNBQTJCLENBQUMsSUFBSSxDQUNyQyxJQUFJLEVBQ0osZUFBZSxFQUNmLE1BQU0sRUFDTixNQUFNLENBQ1AsQ0FBQztLQUNIO0lBRUQsSUFBTSxZQUFZLEdBQUcsSUFBSSxDQUFDLEtBQUssQ0FBQyxlQUFlLEVBQUU7UUFDL0MsOEJBQThCLEVBQUUsSUFBSTtLQUNyQyxDQUFDLENBQUM7SUFDSCxPQUFPLElBQUEsNkJBQWEsRUFBQyxZQUFZLEVBQUUsUUFBUSxFQUFFLE1BQU0sRUFBRSxNQUFNLENBQUMsQ0FBQztBQUMvRCxDQUFDO0FBbkJELDhDQW1CQyJ9
|
|
@@ -12,9 +12,10 @@ function printSingleLambdaInvocation(argumentListCtx, rBrace, lBrace) {
|
|
|
12
12
|
lambdaParametersGroupId: lambdaParametersGroupId,
|
|
13
13
|
isInsideMethodInvocationSuffix: true
|
|
14
14
|
});
|
|
15
|
-
var formattedRBrace = expressions_utils_1.isSingleArgumentLambdaExpressionWithBlock(argumentListCtx)
|
|
16
|
-
? ifBreak(prettier_builder_1.indent(prettier_builder_1.concat([softline, rBrace])), format_comments_1.printTokenWithComments(rBrace), { groupId: lambdaParametersGroupId })
|
|
17
|
-
: prettier_builder_1.indent(prettier_builder_1.concat([softline, rBrace]));
|
|
18
|
-
return prettier_builder_1.dedent(printer_utils_1.putIntoBraces(argumentList, "", lBrace, formattedRBrace));
|
|
15
|
+
var formattedRBrace = (0, expressions_utils_1.isSingleArgumentLambdaExpressionWithBlock)(argumentListCtx)
|
|
16
|
+
? ifBreak((0, prettier_builder_1.indent)((0, prettier_builder_1.concat)([softline, rBrace])), (0, format_comments_1.printTokenWithComments)(rBrace), { groupId: lambdaParametersGroupId })
|
|
17
|
+
: (0, prettier_builder_1.indent)((0, prettier_builder_1.concat)([softline, rBrace]));
|
|
18
|
+
return (0, prettier_builder_1.dedent)((0, printer_utils_1.putIntoBraces)(argumentList, "", lBrace, formattedRBrace));
|
|
19
19
|
}
|
|
20
20
|
exports.default = printSingleLambdaInvocation;
|
|
21
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpbnRTaW5nbGVMYW1iZGFJbnZvY2F0aW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3V0aWxzL3ByaW50U2luZ2xlTGFtYmRhSW52b2NhdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUNBLG9DQUF3QztBQUN4Qyx5REFBZ0Y7QUFDaEYsd0VBQThFO0FBQzlFLGlFQUFzRTtBQUN0RSwyREFBMEQ7QUFFbEQsSUFBQSxRQUFRLEdBQWMsY0FBUSxTQUF0QixFQUFFLE9BQU8sR0FBSyxjQUFRLFFBQWIsQ0FBYztBQUV2QyxTQUF3QiwyQkFBMkIsQ0FDakQsZUFBa0QsRUFDbEQsTUFBYyxFQUNkLE1BQWM7SUFFZCxJQUFNLHVCQUF1QixHQUFHLE1BQU0sQ0FBQyxrQkFBa0IsQ0FBQyxDQUFDO0lBQzNELElBQU0sWUFBWSxHQUFHLElBQUksQ0FBQyxLQUFLLENBQUMsZUFBZSxFQUFFO1FBQy9DLHVCQUF1Qix5QkFBQTtRQUN2Qiw4QkFBOEIsRUFBRSxJQUFJO0tBQ3JDLENBQUMsQ0FBQztJQUVILElBQU0sZUFBZSxHQUFHLElBQUEsNkRBQXlDLEVBQy9ELGVBQWUsQ0FDaEI7UUFDQyxDQUFDLENBQUMsT0FBTyxDQUNMLElBQUEseUJBQU0sRUFBQyxJQUFBLHlCQUFNLEVBQUMsQ0FBQyxRQUFRLEVBQUUsTUFBTSxDQUFDLENBQUMsQ0FBQyxFQUNsQyxJQUFBLHdDQUFzQixFQUFDLE1BQU0sQ0FBQyxFQUM5QixFQUFFLE9BQU8sRUFBRSx1QkFBdUIsRUFBRSxDQUNyQztRQUNILENBQUMsQ0FBQyxJQUFBLHlCQUFNLEVBQUMsSUFBQSx5QkFBTSxFQUFDLENBQUMsUUFBUSxFQUFFLE1BQU0sQ0FBQyxDQUFDLENBQUMsQ0FBQztJQUN2QyxPQUFPLElBQUEseUJBQU0sRUFBQyxJQUFBLDZCQUFhLEVBQUMsWUFBWSxFQUFFLEVBQUUsRUFBRSxNQUFNLEVBQUUsZUFBZSxDQUFDLENBQUMsQ0FBQztBQUMxRSxDQUFDO0FBckJELDhDQXFCQyJ9
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prettier-plugin-java",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Prettier Java Plugin",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -9,38 +9,38 @@
|
|
|
9
9
|
"repository": "https://github.com/jhipster/prettier-java",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"java-parser": "2.0.
|
|
12
|
+
"java-parser": "2.0.3",
|
|
13
13
|
"lodash": "4.17.21",
|
|
14
|
-
"prettier": "2.
|
|
14
|
+
"prettier": "2.8.0"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
|
-
"test": "
|
|
17
|
+
"test": "yarn run test:unit && yarn run test:e2e-core",
|
|
18
18
|
"test:unit": "mocha \"test/unit-test/**/*.spec.ts\" \"test/unit-test/**/*-spec.ts\"",
|
|
19
19
|
"test:e2e-core": "node scripts/clone-samples e2e-core && mocha \"test/repository-test/core-test.ts\"",
|
|
20
20
|
"test:e2e-jhipster1": "node scripts/clone-samples e2e-jhipster1 && mocha \"test/repository-test/jhipster-1-test.ts\"",
|
|
21
21
|
"test:e2e-jhipster2": "node scripts/clone-samples e2e-jhipster2 && mocha \"test/repository-test/jhipster-2-test.ts\"",
|
|
22
|
-
"test:all": "
|
|
22
|
+
"test:all": "yarn run test && yarn run test:e2e-jhipster1 && yarn run test:e2e-jhipster2",
|
|
23
23
|
"clone-samples": "node scripts/clone-samples.js",
|
|
24
24
|
"build": "tsc -p tsconfig.build.json --outDir dist",
|
|
25
|
-
"build:watch": "tsc -p tsconfig.build.json --outDir dist -w"
|
|
25
|
+
"build:watch": "tsc -p tsconfig.build.json --inlineSourceMap --outDir dist -w"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@babel/cli": "7.
|
|
29
|
-
"@babel/core": "7.
|
|
30
|
-
"@babel/preset-env": "7.
|
|
31
|
-
"@babel/preset-typescript": "7.
|
|
32
|
-
"@babel/register": "7.
|
|
28
|
+
"@babel/cli": "7.19.3",
|
|
29
|
+
"@babel/core": "7.20.2",
|
|
30
|
+
"@babel/preset-env": "7.20.2",
|
|
31
|
+
"@babel/preset-typescript": "7.18.6",
|
|
32
|
+
"@babel/register": "7.18.9",
|
|
33
33
|
"@chevrotain/types": "9.0.2",
|
|
34
|
-
"@types/chai": "4.
|
|
35
|
-
"@types/fs-extra": "9.0.
|
|
36
|
-
"@types/jest": "
|
|
34
|
+
"@types/chai": "4.3.4",
|
|
35
|
+
"@types/fs-extra": "9.0.13",
|
|
36
|
+
"@types/jest": "29.2.3",
|
|
37
37
|
"@types/klaw-sync": "6.0.1",
|
|
38
|
-
"@types/lodash": "4.14.
|
|
39
|
-
"@types/node": "
|
|
40
|
-
"@types/prettier": "2.
|
|
41
|
-
"@types/sinon": "10.0.
|
|
42
|
-
"ts-node": "10.
|
|
43
|
-
"typescript": "4.3
|
|
38
|
+
"@types/lodash": "4.14.190",
|
|
39
|
+
"@types/node": "18.11.9",
|
|
40
|
+
"@types/prettier": "2.7.1",
|
|
41
|
+
"@types/sinon": "10.0.13",
|
|
42
|
+
"ts-node": "10.9.1",
|
|
43
|
+
"typescript": "4.9.3"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "d1d1e419bdabb3eb8ba0d94cb0eb3f85166d22e8"
|
|
46
46
|
}
|
package/dist/utils/constants.js
DELETED