prettier-plugin-java 2.5.0 → 2.6.1
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/LICENSE +1 -1
- package/package.json +15 -13
- package/dist/base-cst-printer.js +0 -77
- package/dist/cst-printer.js +0 -37
- package/dist/index.js +0 -67
- package/dist/options.js +0 -258
- package/dist/parser.js +0 -6
- package/dist/printer.js +0 -8
- package/dist/printers/arrays.js +0 -49
- package/dist/printers/blocks-and-statements.js +0 -480
- package/dist/printers/classes.js +0 -745
- package/dist/printers/comments/comments-utils.js +0 -29
- package/dist/printers/comments/format-comments.js +0 -187
- package/dist/printers/comments/handle-comments.js +0 -79
- package/dist/printers/expressions.js +0 -557
- package/dist/printers/interfaces.js +0 -251
- package/dist/printers/lexical-structure.js +0 -63
- package/dist/printers/names.js +0 -53
- package/dist/printers/packages-and-modules.js +0 -198
- package/dist/printers/prettier-builder.js +0 -55
- package/dist/printers/printer-utils.js +0 -640
- package/dist/printers/types-values-and-variables.js +0 -191
- package/dist/types/utils.js +0 -29
- package/dist/utils/expressions-utils.js +0 -29
- package/dist/utils/index.js +0 -12
- package/dist/utils/isEmptyDoc.js +0 -6
- package/dist/utils/printArgumentListWithBraces.js +0 -21
- package/dist/utils/printSingleLambdaInvocation.js +0 -20
package/LICENSE
CHANGED
package/package.json
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prettier-plugin-java",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.1",
|
|
4
4
|
"description": "Prettier Java Plugin",
|
|
5
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./src/index.d.ts",
|
|
9
|
+
"default": "./src/index.js"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
6
12
|
"files": [
|
|
7
13
|
"dist"
|
|
8
14
|
],
|
|
15
|
+
"homepage": "https://jhipster.github.io/prettier-java/",
|
|
9
16
|
"repository": "https://github.com/jhipster/prettier-java",
|
|
10
17
|
"license": "Apache-2.0",
|
|
11
18
|
"dependencies": {
|
|
12
|
-
"java-parser": "2.
|
|
19
|
+
"java-parser": "2.3.1",
|
|
13
20
|
"lodash": "4.17.21",
|
|
14
|
-
"prettier": "3.
|
|
21
|
+
"prettier": "3.2.5"
|
|
15
22
|
},
|
|
16
23
|
"scripts": {
|
|
17
24
|
"test": "yarn run test:unit && yarn run test:e2e-core",
|
|
@@ -21,16 +28,11 @@
|
|
|
21
28
|
"test:e2e-jhipster2": "node scripts/clone-samples e2e-jhipster2 && mocha \"test/repository-test/jhipster-2-test.ts\"",
|
|
22
29
|
"test:all": "yarn run test && yarn run test:e2e-jhipster1 && yarn run test:e2e-jhipster2",
|
|
23
30
|
"clone-samples": "node scripts/clone-samples.js",
|
|
24
|
-
"build": "tsc
|
|
25
|
-
"build:watch": "tsc
|
|
31
|
+
"build": "tsc",
|
|
32
|
+
"build:watch": "tsc --inlineSourceMap -w"
|
|
26
33
|
},
|
|
27
34
|
"devDependencies": {
|
|
28
|
-
"@
|
|
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
|
-
"@chevrotain/types": "9.0.2",
|
|
35
|
+
"@chevrotain/types": "11.0.3",
|
|
34
36
|
"@types/chai": "4.3.4",
|
|
35
37
|
"@types/fs-extra": "9.0.13",
|
|
36
38
|
"@types/jest": "29.2.3",
|
|
@@ -41,5 +43,5 @@
|
|
|
41
43
|
"ts-node": "10.9.1",
|
|
42
44
|
"typescript": "4.9.3"
|
|
43
45
|
},
|
|
44
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "8ee70accfbc3eecd5fb1c5da430701ca4765c994"
|
|
45
47
|
}
|
package/dist/base-cst-printer.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.BaseCstPrettierPrinter = void 0;
|
|
19
|
-
var java_parser_1 = require("java-parser");
|
|
20
|
-
var format_comments_1 = require("./printers/comments/format-comments");
|
|
21
|
-
var BaseCstPrettierPrinter = /** @class */ (function (_super) {
|
|
22
|
-
__extends(BaseCstPrettierPrinter, _super);
|
|
23
|
-
function BaseCstPrettierPrinter() {
|
|
24
|
-
var _this = _super.call(this) || this;
|
|
25
|
-
_this.mapVisit = function (elements, params) {
|
|
26
|
-
if (elements === undefined) {
|
|
27
|
-
// TODO: can optimize this by returning an immutable empty array singleton.
|
|
28
|
-
return [];
|
|
29
|
-
}
|
|
30
|
-
return elements.map(function (element) { return _this.visit(element, params); });
|
|
31
|
-
};
|
|
32
|
-
_this.getSingle = function (ctx) {
|
|
33
|
-
var ctxKeys = Object.keys(ctx);
|
|
34
|
-
if (ctxKeys.length !== 1) {
|
|
35
|
-
throw Error("Expecting single key CST ctx but found: <".concat(ctxKeys.length, "> keys"));
|
|
36
|
-
}
|
|
37
|
-
var singleElementKey = ctxKeys[0];
|
|
38
|
-
var singleElementValues = ctx[singleElementKey];
|
|
39
|
-
if ((singleElementValues === null || singleElementValues === void 0 ? void 0 : singleElementValues.length) !== 1) {
|
|
40
|
-
throw Error("Expecting single item in CST ctx key but found: <".concat(singleElementValues === null || singleElementValues === void 0 ? void 0 : singleElementValues.length, "> items"));
|
|
41
|
-
}
|
|
42
|
-
return singleElementValues[0];
|
|
43
|
-
};
|
|
44
|
-
// @ts-ignore
|
|
45
|
-
_this.orgVisit = _this.visit;
|
|
46
|
-
_this.visit = function (ctx, inParam) {
|
|
47
|
-
if (ctx === undefined) {
|
|
48
|
-
// empty Doc
|
|
49
|
-
return "";
|
|
50
|
-
}
|
|
51
|
-
var node = Array.isArray(ctx) ? ctx[0] : ctx;
|
|
52
|
-
if (node.ignore) {
|
|
53
|
-
try {
|
|
54
|
-
var startOffset = node.leadingComments !== undefined
|
|
55
|
-
? node.leadingComments[0].startOffset
|
|
56
|
-
: node.location.startOffset;
|
|
57
|
-
var endOffset = (node.trailingComments !== undefined
|
|
58
|
-
? node.trailingComments[node.trailingComments.length - 1].endOffset
|
|
59
|
-
: node.location.endOffset);
|
|
60
|
-
return this.prettierOptions.originalText.substring(startOffset, endOffset + 1);
|
|
61
|
-
}
|
|
62
|
-
catch (e) {
|
|
63
|
-
throw Error(e +
|
|
64
|
-
"\nThere might be a problem with prettier-ignore, please report an issue on https://github.com/jhipster/prettier-java/issues");
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return (0, format_comments_1.printNodeWithComments)(node, this.orgVisit.call(this, node, inParam));
|
|
68
|
-
};
|
|
69
|
-
_this.visitSingle = function (ctx, params) {
|
|
70
|
-
var singleElement = this.getSingle(ctx);
|
|
71
|
-
return this.visit(singleElement, params);
|
|
72
|
-
};
|
|
73
|
-
return _this;
|
|
74
|
-
}
|
|
75
|
-
return BaseCstPrettierPrinter;
|
|
76
|
-
}(java_parser_1.BaseJavaCstVisitor));
|
|
77
|
-
exports.BaseCstPrettierPrinter = BaseCstPrettierPrinter;
|
package/dist/cst-printer.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createPrettierDoc = void 0;
|
|
4
|
-
var base_cst_printer_1 = require("./base-cst-printer");
|
|
5
|
-
var arrays_1 = require("./printers/arrays");
|
|
6
|
-
var blocks_and_statements_1 = require("./printers/blocks-and-statements");
|
|
7
|
-
var classes_1 = require("./printers/classes");
|
|
8
|
-
var expressions_1 = require("./printers/expressions");
|
|
9
|
-
var interfaces_1 = require("./printers/interfaces");
|
|
10
|
-
var lexical_structure_1 = require("./printers/lexical-structure");
|
|
11
|
-
var names_1 = require("./printers/names");
|
|
12
|
-
var types_values_and_variables_1 = require("./printers/types-values-and-variables");
|
|
13
|
-
var packages_and_modules_1 = require("./printers/packages-and-modules");
|
|
14
|
-
// Mixins for the win
|
|
15
|
-
mixInMethods(arrays_1.ArraysPrettierVisitor, blocks_and_statements_1.BlocksAndStatementPrettierVisitor, classes_1.ClassesPrettierVisitor, expressions_1.ExpressionsPrettierVisitor, interfaces_1.InterfacesPrettierVisitor, lexical_structure_1.LexicalStructurePrettierVisitor, names_1.NamesPrettierVisitor, types_values_and_variables_1.TypesValuesAndVariablesPrettierVisitor, packages_and_modules_1.PackagesAndModulesPrettierVisitor);
|
|
16
|
-
function mixInMethods() {
|
|
17
|
-
var classesToMix = [];
|
|
18
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
19
|
-
classesToMix[_i] = arguments[_i];
|
|
20
|
-
}
|
|
21
|
-
classesToMix.forEach(function (from) {
|
|
22
|
-
var fromMethodsNames = Object.getOwnPropertyNames(from.prototype);
|
|
23
|
-
var fromPureMethodsName = fromMethodsNames.filter(function (methodName) { return methodName !== "constructor"; });
|
|
24
|
-
fromPureMethodsName.forEach(function (methodName) {
|
|
25
|
-
// @ts-ignore
|
|
26
|
-
base_cst_printer_1.BaseCstPrettierPrinter.prototype[methodName] = from.prototype[methodName];
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
var prettyPrinter = new base_cst_printer_1.BaseCstPrettierPrinter();
|
|
31
|
-
// TODO: do we need the "path" and "print" arguments passed by prettier
|
|
32
|
-
// see https://github.com/prettier/prettier/issues/5747
|
|
33
|
-
function createPrettierDoc(cstNode, options) {
|
|
34
|
-
prettyPrinter.prettierOptions = options;
|
|
35
|
-
return prettyPrinter.visit(cstNode);
|
|
36
|
-
}
|
|
37
|
-
exports.createPrettierDoc = createPrettierDoc;
|
package/dist/index.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var parse = require("./parser");
|
|
3
|
-
var print = require("./printer");
|
|
4
|
-
var options = require("./options");
|
|
5
|
-
var languages = [
|
|
6
|
-
{
|
|
7
|
-
name: "Java",
|
|
8
|
-
parsers: ["java"],
|
|
9
|
-
group: "Java",
|
|
10
|
-
tmScope: "text.html.vue",
|
|
11
|
-
aceMode: "html",
|
|
12
|
-
codemirrorMode: "clike",
|
|
13
|
-
codemirrorMimeType: "text/x-java",
|
|
14
|
-
extensions: [".java"],
|
|
15
|
-
linguistLanguageId: 181,
|
|
16
|
-
vscodeLanguageIds: ["java"]
|
|
17
|
-
}
|
|
18
|
-
];
|
|
19
|
-
function locStart( /* node */) {
|
|
20
|
-
return -1;
|
|
21
|
-
}
|
|
22
|
-
function locEnd( /* node */) {
|
|
23
|
-
return -1;
|
|
24
|
-
}
|
|
25
|
-
function hasPragma(text) {
|
|
26
|
-
return /^\/\*\*[\n][\t\s]+\*\s@(prettier|format)[\n][\t\s]+\*\//.test(text);
|
|
27
|
-
}
|
|
28
|
-
var parsers = {
|
|
29
|
-
java: {
|
|
30
|
-
parse: parse,
|
|
31
|
-
astFormat: "java",
|
|
32
|
-
locStart: locStart,
|
|
33
|
-
locEnd: locEnd,
|
|
34
|
-
hasPragma: hasPragma
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
function canAttachComment(node) {
|
|
38
|
-
return node.ast_type && node.ast_type !== "comment";
|
|
39
|
-
}
|
|
40
|
-
function printComment(commentPath) {
|
|
41
|
-
var comment = commentPath.getValue();
|
|
42
|
-
switch (comment.ast_type) {
|
|
43
|
-
case "comment":
|
|
44
|
-
return comment.value;
|
|
45
|
-
default:
|
|
46
|
-
throw new Error("Not a comment: " + JSON.stringify(comment));
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
function clean(ast, newObj) {
|
|
50
|
-
delete newObj.lineno;
|
|
51
|
-
delete newObj.col_offset;
|
|
52
|
-
}
|
|
53
|
-
var printers = {
|
|
54
|
-
java: {
|
|
55
|
-
print: print,
|
|
56
|
-
// hasPrettierIgnore,
|
|
57
|
-
printComment: printComment,
|
|
58
|
-
canAttachComment: canAttachComment,
|
|
59
|
-
massageAstNode: clean
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
module.exports = {
|
|
63
|
-
languages: languages,
|
|
64
|
-
printers: printers,
|
|
65
|
-
parsers: parsers,
|
|
66
|
-
options: options
|
|
67
|
-
};
|
package/dist/options.js
DELETED
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
module.exports = {
|
|
3
|
-
entrypoint: {
|
|
4
|
-
type: "choice",
|
|
5
|
-
category: "Global",
|
|
6
|
-
default: "compilationUnit",
|
|
7
|
-
// sed -nr 's/.*\.RULE\(([^,]+),.*/\1/p' $(ls path/to/java-parser/rules/folder/*)
|
|
8
|
-
choices: [
|
|
9
|
-
{ value: "arrayInitializer" },
|
|
10
|
-
{ value: "variableInitializerList" },
|
|
11
|
-
{ value: "block" },
|
|
12
|
-
{ value: "blockStatements" },
|
|
13
|
-
{ value: "blockStatement" },
|
|
14
|
-
{ value: "localVariableDeclarationStatement" },
|
|
15
|
-
{ value: "localVariableDeclaration" },
|
|
16
|
-
{ value: "localVariableType" },
|
|
17
|
-
{ value: "statement" },
|
|
18
|
-
{ value: "statementWithoutTrailingSubstatement" },
|
|
19
|
-
{ value: "emptyStatement" },
|
|
20
|
-
{ value: "labeledStatement" },
|
|
21
|
-
{ value: "expressionStatement" },
|
|
22
|
-
{ value: "statementExpression" },
|
|
23
|
-
{ value: "ifStatement" },
|
|
24
|
-
{ value: "assertStatement" },
|
|
25
|
-
{ value: "switchStatement" },
|
|
26
|
-
{ value: "switchBlock" },
|
|
27
|
-
{ value: "switchBlockStatementGroup" },
|
|
28
|
-
{ value: "switchLabel" },
|
|
29
|
-
{ value: "switchRule" },
|
|
30
|
-
{ value: "caseConstant" },
|
|
31
|
-
{ value: "whileStatement" },
|
|
32
|
-
{ value: "doStatement" },
|
|
33
|
-
{ value: "forStatement" },
|
|
34
|
-
{ value: "basicForStatement" },
|
|
35
|
-
{ value: "forInit" },
|
|
36
|
-
{ value: "forUpdate" },
|
|
37
|
-
{ value: "statementExpressionList" },
|
|
38
|
-
{ value: "enhancedForStatement" },
|
|
39
|
-
{ value: "breakStatement" },
|
|
40
|
-
{ value: "continueStatement" },
|
|
41
|
-
{ value: "returnStatement" },
|
|
42
|
-
{ value: "throwStatement" },
|
|
43
|
-
{ value: "synchronizedStatement" },
|
|
44
|
-
{ value: "tryStatement" },
|
|
45
|
-
{ value: "catches" },
|
|
46
|
-
{ value: "catchClause" },
|
|
47
|
-
{ value: "catchFormalParameter" },
|
|
48
|
-
{ value: "catchType" },
|
|
49
|
-
{ value: "finally" },
|
|
50
|
-
{ value: "tryWithResourcesStatement" },
|
|
51
|
-
{ value: "resourceSpecification" },
|
|
52
|
-
{ value: "resourceList" },
|
|
53
|
-
{ value: "resource" },
|
|
54
|
-
{ value: "yieldStatement" },
|
|
55
|
-
{ value: "variableAccess" },
|
|
56
|
-
{ value: "isBasicForStatement" },
|
|
57
|
-
{ value: "isLocalVariableDeclaration" },
|
|
58
|
-
{ value: "isClassicSwitchLabel" },
|
|
59
|
-
{ value: "classDeclaration" },
|
|
60
|
-
{ value: "normalClassDeclaration" },
|
|
61
|
-
{ value: "classModifier" },
|
|
62
|
-
{ value: "typeParameters" },
|
|
63
|
-
{ value: "typeParameterList" },
|
|
64
|
-
{ value: "superclass" },
|
|
65
|
-
{ value: "superinterfaces" },
|
|
66
|
-
{ value: "interfaceTypeList" },
|
|
67
|
-
{ value: "classPermits" },
|
|
68
|
-
{ value: "classBody" },
|
|
69
|
-
{ value: "classBodyDeclaration" },
|
|
70
|
-
{ value: "classMemberDeclaration" },
|
|
71
|
-
{ value: "fieldDeclaration" },
|
|
72
|
-
{ value: "fieldModifier" },
|
|
73
|
-
{ value: "variableDeclaratorList" },
|
|
74
|
-
{ value: "variableDeclarator" },
|
|
75
|
-
{ value: "variableDeclaratorId" },
|
|
76
|
-
{ value: "variableInitializer" },
|
|
77
|
-
{ value: "unannType" },
|
|
78
|
-
{ value: "unannPrimitiveTypeWithOptionalDimsSuffix" },
|
|
79
|
-
{ value: "unannPrimitiveType" },
|
|
80
|
-
{ value: "unannReferenceType" },
|
|
81
|
-
{ value: "unannClassOrInterfaceType" },
|
|
82
|
-
{ value: "unannClassType" },
|
|
83
|
-
{ value: "unannInterfaceType" },
|
|
84
|
-
{ value: "unannTypeVariable" },
|
|
85
|
-
{ value: "methodDeclaration" },
|
|
86
|
-
{ value: "methodModifier" },
|
|
87
|
-
{ value: "methodHeader" },
|
|
88
|
-
{ value: "result" },
|
|
89
|
-
{ value: "methodDeclarator" },
|
|
90
|
-
{ value: "receiverParameter" },
|
|
91
|
-
{ value: "formalParameterList" },
|
|
92
|
-
{ value: "formalParameter" },
|
|
93
|
-
{ value: "variableParaRegularParameter" },
|
|
94
|
-
{ value: "variableArityParameter" },
|
|
95
|
-
{ value: "variableModifier" },
|
|
96
|
-
{ value: "throws" },
|
|
97
|
-
{ value: "exceptionTypeList" },
|
|
98
|
-
{ value: "exceptionType" },
|
|
99
|
-
{ value: "methodBody" },
|
|
100
|
-
{ value: "instanceInitializer" },
|
|
101
|
-
{ value: "staticInitializer" },
|
|
102
|
-
{ value: "constructorDeclaration" },
|
|
103
|
-
{ value: "constructorModifier" },
|
|
104
|
-
{ value: "constructorDeclarator" },
|
|
105
|
-
{ value: "simpleTypeName" },
|
|
106
|
-
{ value: "constructorBody" },
|
|
107
|
-
{ value: "explicitConstructorInvocation" },
|
|
108
|
-
{ value: "unqualifiedExplicitConstructorInvocation" },
|
|
109
|
-
{ value: "qualifiedExplicitConstructorInvocation" },
|
|
110
|
-
{ value: "enumDeclaration" },
|
|
111
|
-
{ value: "enumBody" },
|
|
112
|
-
{ value: "enumConstantList" },
|
|
113
|
-
{ value: "enumConstant" },
|
|
114
|
-
{ value: "enumConstantModifier" },
|
|
115
|
-
{ value: "enumBodyDeclarations" },
|
|
116
|
-
{ value: "recordDeclaration" },
|
|
117
|
-
{ value: "recordHeader" },
|
|
118
|
-
{ value: "recordComponentList" },
|
|
119
|
-
{ value: "recordComponent" },
|
|
120
|
-
{ value: "variableArityRecordComponent" },
|
|
121
|
-
{ value: "recordComponentModifier" },
|
|
122
|
-
{ value: "recordBody" },
|
|
123
|
-
{ value: "recordBodyDeclaration" },
|
|
124
|
-
{ value: "compactConstructorDeclaration" },
|
|
125
|
-
{ value: "isClassDeclaration" },
|
|
126
|
-
{ value: "identifyClassBodyDeclarationType" },
|
|
127
|
-
{ value: "isDims" },
|
|
128
|
-
{ value: "isCompactConstructorDeclaration" },
|
|
129
|
-
{ value: "expression" },
|
|
130
|
-
{ value: "lambdaExpression" },
|
|
131
|
-
{ value: "lambdaParameters" },
|
|
132
|
-
{ value: "lambdaParametersWithBraces" },
|
|
133
|
-
{ value: "lambdaParameterList" },
|
|
134
|
-
{ value: "inferredLambdaParameterList" },
|
|
135
|
-
{ value: "explicitLambdaParameterList" },
|
|
136
|
-
{ value: "lambdaParameter" },
|
|
137
|
-
{ value: "regularLambdaParameter" },
|
|
138
|
-
{ value: "lambdaParameterType" },
|
|
139
|
-
{ value: "lambdaBody" },
|
|
140
|
-
{ value: "ternaryExpression" },
|
|
141
|
-
{ value: "binaryExpression" },
|
|
142
|
-
{ value: "unaryExpression" },
|
|
143
|
-
{ value: "unaryExpressionNotPlusMinus" },
|
|
144
|
-
{ value: "primary" },
|
|
145
|
-
{ value: "primaryPrefix" },
|
|
146
|
-
{ value: "primarySuffix" },
|
|
147
|
-
{ value: "fqnOrRefType" },
|
|
148
|
-
{ value: "fqnOrRefTypePartRest" },
|
|
149
|
-
{ value: "fqnOrRefTypePartCommon" },
|
|
150
|
-
{ value: "fqnOrRefTypePartFirst" },
|
|
151
|
-
{ value: "parenthesisExpression" },
|
|
152
|
-
{ value: "castExpression" },
|
|
153
|
-
{ value: "primitiveCastExpression" },
|
|
154
|
-
{ value: "referenceTypeCastExpression" },
|
|
155
|
-
{ value: "newExpression" },
|
|
156
|
-
{ value: "unqualifiedClassInstanceCreationExpression" },
|
|
157
|
-
{ value: "classOrInterfaceTypeToInstantiate" },
|
|
158
|
-
{ value: "typeArgumentsOrDiamond" },
|
|
159
|
-
{ value: "diamond" },
|
|
160
|
-
{ value: "methodInvocationSuffix" },
|
|
161
|
-
{ value: "argumentList" },
|
|
162
|
-
{ value: "arrayCreationExpression" },
|
|
163
|
-
{ value: "arrayCreationDefaultInitSuffix" },
|
|
164
|
-
{ value: "arrayCreationExplicitInitSuffix" },
|
|
165
|
-
{ value: "dimExprs" },
|
|
166
|
-
{ value: "dimExpr" },
|
|
167
|
-
{ value: "classLiteralSuffix" },
|
|
168
|
-
{ value: "arrayAccessSuffix" },
|
|
169
|
-
{ value: "methodReferenceSuffix" },
|
|
170
|
-
{ value: "pattern" },
|
|
171
|
-
{ value: "typePattern" },
|
|
172
|
-
{ value: "recordPattern" },
|
|
173
|
-
{ value: "componentPatternList" },
|
|
174
|
-
{ value: "componentPattern" },
|
|
175
|
-
{ value: "unnamedPattern" },
|
|
176
|
-
{ value: "guard" },
|
|
177
|
-
{ value: "identifyNewExpressionType" },
|
|
178
|
-
{ value: "isLambdaExpression" },
|
|
179
|
-
{ value: "isCastExpression" },
|
|
180
|
-
{ value: "isPrimitiveCastExpression" },
|
|
181
|
-
{ value: "isReferenceTypeCastExpression" },
|
|
182
|
-
{ value: "isRefTypeInMethodRef" },
|
|
183
|
-
{ value: "interfaceDeclaration" },
|
|
184
|
-
{ value: "normalInterfaceDeclaration" },
|
|
185
|
-
{ value: "interfaceModifier" },
|
|
186
|
-
{ value: "extendsInterfaces" },
|
|
187
|
-
{ value: "interfacePermits" },
|
|
188
|
-
{ value: "interfaceBody" },
|
|
189
|
-
{ value: "interfaceMemberDeclaration" },
|
|
190
|
-
{ value: "constantDeclaration" },
|
|
191
|
-
{ value: "constantModifier" },
|
|
192
|
-
{ value: "interfaceMethodDeclaration" },
|
|
193
|
-
{ value: "interfaceMethodModifier" },
|
|
194
|
-
{ value: "annotationTypeDeclaration" },
|
|
195
|
-
{ value: "annotationTypeBody" },
|
|
196
|
-
{ value: "annotationTypeMemberDeclaration" },
|
|
197
|
-
{ value: "annotationTypeElementDeclaration" },
|
|
198
|
-
{ value: "annotationTypeElementModifier" },
|
|
199
|
-
{ value: "defaultValue" },
|
|
200
|
-
{ value: "annotation" },
|
|
201
|
-
{ value: "elementValuePairList" },
|
|
202
|
-
{ value: "elementValuePair" },
|
|
203
|
-
{ value: "elementValue" },
|
|
204
|
-
{ value: "elementValueArrayInitializer" },
|
|
205
|
-
{ value: "elementValueList" },
|
|
206
|
-
{ value: "identifyInterfaceBodyDeclarationType" },
|
|
207
|
-
{ value: "identifyAnnotationBodyDeclarationType" },
|
|
208
|
-
{ value: "isSimpleElementValueAnnotation" },
|
|
209
|
-
{ value: "literal" },
|
|
210
|
-
{ value: "integerLiteral" },
|
|
211
|
-
{ value: "floatingPointLiteral" },
|
|
212
|
-
{ value: "booleanLiteral" },
|
|
213
|
-
{ value: "moduleName" },
|
|
214
|
-
{ value: "packageName" },
|
|
215
|
-
{ value: "typeName" },
|
|
216
|
-
{ value: "expressionName" },
|
|
217
|
-
{ value: "methodName" },
|
|
218
|
-
{ value: "packageOrTypeName" },
|
|
219
|
-
{ value: "ambiguousName" },
|
|
220
|
-
{ value: "compilationUnit" },
|
|
221
|
-
{ value: "ordinaryCompilationUnit" },
|
|
222
|
-
{ value: "modularCompilationUnit" },
|
|
223
|
-
{ value: "packageDeclaration" },
|
|
224
|
-
{ value: "packageModifier" },
|
|
225
|
-
{ value: "importDeclaration" },
|
|
226
|
-
{ value: "typeDeclaration" },
|
|
227
|
-
{ value: "moduleDeclaration" },
|
|
228
|
-
{ value: "moduleDirective" },
|
|
229
|
-
{ value: "requiresModuleDirective" },
|
|
230
|
-
{ value: "exportsModuleDirective" },
|
|
231
|
-
{ value: "opensModuleDirective" },
|
|
232
|
-
{ value: "usesModuleDirective" },
|
|
233
|
-
{ value: "providesModuleDirective" },
|
|
234
|
-
{ value: "requiresModifier" },
|
|
235
|
-
{ value: "isModuleCompilationUnit" },
|
|
236
|
-
{ value: "primitiveType" },
|
|
237
|
-
{ value: "numericType" },
|
|
238
|
-
{ value: "integralType" },
|
|
239
|
-
{ value: "floatingPointType" },
|
|
240
|
-
{ value: "referenceType" },
|
|
241
|
-
{ value: "classOrInterfaceType" },
|
|
242
|
-
{ value: "classType" },
|
|
243
|
-
{ value: "interfaceType" },
|
|
244
|
-
{ value: "typeVariable" },
|
|
245
|
-
{ value: "dims" },
|
|
246
|
-
{ value: "typeParameter" },
|
|
247
|
-
{ value: "typeParameterModifier" },
|
|
248
|
-
{ value: "typeBound" },
|
|
249
|
-
{ value: "additionalBound" },
|
|
250
|
-
{ value: "typeArguments" },
|
|
251
|
-
{ value: "typeArgumentList" },
|
|
252
|
-
{ value: "typeArgument" },
|
|
253
|
-
{ value: "wildcard" },
|
|
254
|
-
{ value: "wildcardBounds" }
|
|
255
|
-
],
|
|
256
|
-
description: "Prettify from the entrypoint, allowing to use prettier on snippet."
|
|
257
|
-
}
|
|
258
|
-
};
|
package/dist/parser.js
DELETED
package/dist/printer.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var createPrettierDoc = require("./cst-printer").createPrettierDoc;
|
|
3
|
-
// eslint-disable-next-line no-unused-vars
|
|
4
|
-
function genericPrint(path, options, print) {
|
|
5
|
-
var node = path.getValue();
|
|
6
|
-
return createPrettierDoc(node, options);
|
|
7
|
-
}
|
|
8
|
-
module.exports = genericPrint;
|
package/dist/printers/arrays.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.ArraysPrettierVisitor = void 0;
|
|
19
|
-
var printer_utils_1 = require("./printer-utils");
|
|
20
|
-
var doc_1 = require("prettier/doc");
|
|
21
|
-
var base_cst_printer_1 = require("../base-cst-printer");
|
|
22
|
-
var line = doc_1.builders.line;
|
|
23
|
-
var ArraysPrettierVisitor = /** @class */ (function (_super) {
|
|
24
|
-
__extends(ArraysPrettierVisitor, _super);
|
|
25
|
-
function ArraysPrettierVisitor() {
|
|
26
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
27
|
-
}
|
|
28
|
-
ArraysPrettierVisitor.prototype.arrayInitializer = function (ctx) {
|
|
29
|
-
var optionalVariableInitializerList = this.visit(ctx.variableInitializerList);
|
|
30
|
-
return (0, printer_utils_1.printArrayList)({
|
|
31
|
-
list: optionalVariableInitializerList,
|
|
32
|
-
extraComma: ctx.Comma,
|
|
33
|
-
LCurly: ctx.LCurly[0],
|
|
34
|
-
RCurly: ctx.RCurly[0],
|
|
35
|
-
trailingComma: this.prettierOptions.trailingComma
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
ArraysPrettierVisitor.prototype.variableInitializerList = function (ctx) {
|
|
39
|
-
var variableInitializers = this.mapVisit(ctx.variableInitializer);
|
|
40
|
-
var commas = ctx.Comma
|
|
41
|
-
? ctx.Comma.map(function (comma) {
|
|
42
|
-
return (0, printer_utils_1.rejectAndConcat)([comma, line]);
|
|
43
|
-
})
|
|
44
|
-
: [];
|
|
45
|
-
return (0, printer_utils_1.rejectAndJoinSeps)(commas, variableInitializers);
|
|
46
|
-
};
|
|
47
|
-
return ArraysPrettierVisitor;
|
|
48
|
-
}(base_cst_printer_1.BaseCstPrettierPrinter));
|
|
49
|
-
exports.ArraysPrettierVisitor = ArraysPrettierVisitor;
|