prettier-plugin-java 2.8.0 → 2.9.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/README.md +42 -102
- package/dist/index.cjs +2215 -0
- package/dist/index.d.cts +1630 -0
- package/dist/index.d.mts +1633 -0
- package/dist/index.mjs +2215 -0
- package/dist/tree-sitter-java_orchard.wasm +0 -0
- package/package.json +62 -24
- package/dist/comments.d.ts +0 -17
- package/dist/comments.js +0 -229
- package/dist/index.d.ts +0 -563
- package/dist/index.js +0 -29
- package/dist/options.d.ts +0 -43
- package/dist/options.js +0 -284
- package/dist/parser.d.ts +0 -9
- package/dist/parser.js +0 -24
- package/dist/printer.d.ts +0 -18
- package/dist/printer.js +0 -40
- package/dist/printers/arrays.d.ts +0 -9
- package/dist/printers/arrays.js +0 -9
- package/dist/printers/blocks-and-statements.d.ts +0 -117
- package/dist/printers/blocks-and-statements.js +0 -340
- package/dist/printers/classes.d.ts +0 -157
- package/dist/printers/classes.js +0 -485
- package/dist/printers/expressions.d.ts +0 -134
- package/dist/printers/expressions.js +0 -625
- package/dist/printers/helpers.d.ts +0 -73
- package/dist/printers/helpers.js +0 -273
- package/dist/printers/index.d.ts +0 -2
- package/dist/printers/index.js +0 -13
- package/dist/printers/interfaces.d.ts +0 -62
- package/dist/printers/interfaces.js +0 -175
- package/dist/printers/lexical-structure.d.ts +0 -14
- package/dist/printers/lexical-structure.js +0 -29
- package/dist/printers/names.d.ts +0 -12
- package/dist/printers/names.js +0 -11
- package/dist/printers/packages-and-modules.d.ts +0 -46
- package/dist/printers/packages-and-modules.js +0 -169
- package/dist/printers/types-values-and-variables.d.ts +0 -46
- package/dist/printers/types-values-and-variables.js +0 -90
package/dist/options.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
entrypoint: {
|
|
3
|
-
type: "choice";
|
|
4
|
-
category: string;
|
|
5
|
-
default: string;
|
|
6
|
-
choices: {
|
|
7
|
-
value: string;
|
|
8
|
-
description: string;
|
|
9
|
-
}[];
|
|
10
|
-
description: string;
|
|
11
|
-
};
|
|
12
|
-
arrowParens: {
|
|
13
|
-
type: "choice";
|
|
14
|
-
category: string;
|
|
15
|
-
default: string;
|
|
16
|
-
choices: {
|
|
17
|
-
value: string;
|
|
18
|
-
description: string;
|
|
19
|
-
}[];
|
|
20
|
-
description: string;
|
|
21
|
-
};
|
|
22
|
-
trailingComma: {
|
|
23
|
-
type: "choice";
|
|
24
|
-
category: string;
|
|
25
|
-
default: string;
|
|
26
|
-
choices: {
|
|
27
|
-
value: string;
|
|
28
|
-
description: string;
|
|
29
|
-
}[];
|
|
30
|
-
description: string;
|
|
31
|
-
};
|
|
32
|
-
experimentalOperatorPosition: {
|
|
33
|
-
type: "choice";
|
|
34
|
-
category: string;
|
|
35
|
-
default: string;
|
|
36
|
-
choices: {
|
|
37
|
-
value: string;
|
|
38
|
-
description: string;
|
|
39
|
-
}[];
|
|
40
|
-
description: string;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
export default _default;
|
package/dist/options.js
DELETED
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
entrypoint: {
|
|
3
|
-
type: "choice",
|
|
4
|
-
category: "Global",
|
|
5
|
-
default: "compilationUnit",
|
|
6
|
-
// sed -nr 's/.*\.RULE\(([^,]+),.*/\1/p' $(ls path/to/java-parser/rules/folder/*)
|
|
7
|
-
choices: [
|
|
8
|
-
{ value: "arrayInitializer", description: "" },
|
|
9
|
-
{ value: "variableInitializerList", description: "" },
|
|
10
|
-
{ value: "block", description: "" },
|
|
11
|
-
{ value: "blockStatements", description: "" },
|
|
12
|
-
{ value: "blockStatement", description: "" },
|
|
13
|
-
{ value: "localVariableDeclarationStatement", description: "" },
|
|
14
|
-
{ value: "localVariableDeclaration", description: "" },
|
|
15
|
-
{ value: "localVariableType", description: "" },
|
|
16
|
-
{ value: "statement", description: "" },
|
|
17
|
-
{ value: "statementWithoutTrailingSubstatement", description: "" },
|
|
18
|
-
{ value: "emptyStatement", description: "" },
|
|
19
|
-
{ value: "labeledStatement", description: "" },
|
|
20
|
-
{ value: "expressionStatement", description: "" },
|
|
21
|
-
{ value: "statementExpression", description: "" },
|
|
22
|
-
{ value: "ifStatement", description: "" },
|
|
23
|
-
{ value: "assertStatement", description: "" },
|
|
24
|
-
{ value: "switchStatement", description: "" },
|
|
25
|
-
{ value: "switchBlock", description: "" },
|
|
26
|
-
{ value: "switchBlockStatementGroup", description: "" },
|
|
27
|
-
{ value: "switchLabel", description: "" },
|
|
28
|
-
{ value: "switchRule", description: "" },
|
|
29
|
-
{ value: "caseConstant", description: "" },
|
|
30
|
-
{ value: "casePattern", description: "" },
|
|
31
|
-
{ value: "whileStatement", description: "" },
|
|
32
|
-
{ value: "doStatement", description: "" },
|
|
33
|
-
{ value: "forStatement", description: "" },
|
|
34
|
-
{ value: "basicForStatement", description: "" },
|
|
35
|
-
{ value: "forInit", description: "" },
|
|
36
|
-
{ value: "forUpdate", description: "" },
|
|
37
|
-
{ value: "statementExpressionList", description: "" },
|
|
38
|
-
{ value: "enhancedForStatement", description: "" },
|
|
39
|
-
{ value: "breakStatement", description: "" },
|
|
40
|
-
{ value: "continueStatement", description: "" },
|
|
41
|
-
{ value: "returnStatement", description: "" },
|
|
42
|
-
{ value: "throwStatement", description: "" },
|
|
43
|
-
{ value: "synchronizedStatement", description: "" },
|
|
44
|
-
{ value: "tryStatement", description: "" },
|
|
45
|
-
{ value: "catches", description: "" },
|
|
46
|
-
{ value: "catchClause", description: "" },
|
|
47
|
-
{ value: "catchFormalParameter", description: "" },
|
|
48
|
-
{ value: "catchType", description: "" },
|
|
49
|
-
{ value: "finally", description: "" },
|
|
50
|
-
{ value: "tryWithResourcesStatement", description: "" },
|
|
51
|
-
{ value: "resourceSpecification", description: "" },
|
|
52
|
-
{ value: "resourceList", description: "" },
|
|
53
|
-
{ value: "resource", description: "" },
|
|
54
|
-
{ value: "yieldStatement", description: "" },
|
|
55
|
-
{ value: "variableAccess", description: "" },
|
|
56
|
-
{ value: "classDeclaration", description: "" },
|
|
57
|
-
{ value: "normalClassDeclaration", description: "" },
|
|
58
|
-
{ value: "classModifier", description: "" },
|
|
59
|
-
{ value: "typeParameters", description: "" },
|
|
60
|
-
{ value: "typeParameterList", description: "" },
|
|
61
|
-
{ value: "classExtends", description: "" },
|
|
62
|
-
{ value: "classImplements", description: "" },
|
|
63
|
-
{ value: "interfaceTypeList", description: "" },
|
|
64
|
-
{ value: "classPermits", description: "" },
|
|
65
|
-
{ value: "classBody", description: "" },
|
|
66
|
-
{ value: "classBodyDeclaration", description: "" },
|
|
67
|
-
{ value: "classMemberDeclaration", description: "" },
|
|
68
|
-
{ value: "fieldDeclaration", description: "" },
|
|
69
|
-
{ value: "fieldModifier", description: "" },
|
|
70
|
-
{ value: "variableDeclaratorList", description: "" },
|
|
71
|
-
{ value: "variableDeclarator", description: "" },
|
|
72
|
-
{ value: "variableDeclaratorId", description: "" },
|
|
73
|
-
{ value: "variableInitializer", description: "" },
|
|
74
|
-
{ value: "unannType", description: "" },
|
|
75
|
-
{ value: "unannPrimitiveTypeWithOptionalDimsSuffix", description: "" },
|
|
76
|
-
{ value: "unannPrimitiveType", description: "" },
|
|
77
|
-
{ value: "unannReferenceType", description: "" },
|
|
78
|
-
{ value: "unannClassOrInterfaceType", description: "" },
|
|
79
|
-
{ value: "unannClassType", description: "" },
|
|
80
|
-
{ value: "unannInterfaceType", description: "" },
|
|
81
|
-
{ value: "unannTypeVariable", description: "" },
|
|
82
|
-
{ value: "methodDeclaration", description: "" },
|
|
83
|
-
{ value: "methodModifier", description: "" },
|
|
84
|
-
{ value: "methodHeader", description: "" },
|
|
85
|
-
{ value: "result", description: "" },
|
|
86
|
-
{ value: "methodDeclarator", description: "" },
|
|
87
|
-
{ value: "receiverParameter", description: "" },
|
|
88
|
-
{ value: "formalParameterList", description: "" },
|
|
89
|
-
{ value: "formalParameter", description: "" },
|
|
90
|
-
{ value: "variableParaRegularParameter", description: "" },
|
|
91
|
-
{ value: "variableArityParameter", description: "" },
|
|
92
|
-
{ value: "variableModifier", description: "" },
|
|
93
|
-
{ value: "throws", description: "" },
|
|
94
|
-
{ value: "exceptionTypeList", description: "" },
|
|
95
|
-
{ value: "exceptionType", description: "" },
|
|
96
|
-
{ value: "methodBody", description: "" },
|
|
97
|
-
{ value: "instanceInitializer", description: "" },
|
|
98
|
-
{ value: "staticInitializer", description: "" },
|
|
99
|
-
{ value: "constructorDeclaration", description: "" },
|
|
100
|
-
{ value: "constructorModifier", description: "" },
|
|
101
|
-
{ value: "constructorDeclarator", description: "" },
|
|
102
|
-
{ value: "simpleTypeName", description: "" },
|
|
103
|
-
{ value: "constructorBody", description: "" },
|
|
104
|
-
{ value: "explicitConstructorInvocation", description: "" },
|
|
105
|
-
{ value: "unqualifiedExplicitConstructorInvocation", description: "" },
|
|
106
|
-
{ value: "qualifiedExplicitConstructorInvocation", description: "" },
|
|
107
|
-
{ value: "enumDeclaration", description: "" },
|
|
108
|
-
{ value: "enumBody", description: "" },
|
|
109
|
-
{ value: "enumConstantList", description: "" },
|
|
110
|
-
{ value: "enumConstant", description: "" },
|
|
111
|
-
{ value: "enumConstantModifier", description: "" },
|
|
112
|
-
{ value: "enumBodyDeclarations", description: "" },
|
|
113
|
-
{ value: "recordDeclaration", description: "" },
|
|
114
|
-
{ value: "recordHeader", description: "" },
|
|
115
|
-
{ value: "recordComponentList", description: "" },
|
|
116
|
-
{ value: "recordComponent", description: "" },
|
|
117
|
-
{ value: "variableArityRecordComponent", description: "" },
|
|
118
|
-
{ value: "recordComponentModifier", description: "" },
|
|
119
|
-
{ value: "recordBody", description: "" },
|
|
120
|
-
{ value: "recordBodyDeclaration", description: "" },
|
|
121
|
-
{ value: "compactConstructorDeclaration", description: "" },
|
|
122
|
-
{ value: "isDims", description: "" },
|
|
123
|
-
{ value: "expression", description: "" },
|
|
124
|
-
{ value: "lambdaExpression", description: "" },
|
|
125
|
-
{ value: "lambdaParameters", description: "" },
|
|
126
|
-
{ value: "lambdaParametersWithBraces", description: "" },
|
|
127
|
-
{ value: "lambdaParameterList", description: "" },
|
|
128
|
-
{ value: "conciseLambdaParameterList", description: "" },
|
|
129
|
-
{ value: "normalLambdaParameterList", description: "" },
|
|
130
|
-
{ value: "normalLambdaParameter", description: "" },
|
|
131
|
-
{ value: "regularLambdaParameter", description: "" },
|
|
132
|
-
{ value: "lambdaParameterType", description: "" },
|
|
133
|
-
{ value: "conciseLambdaParameter", description: "" },
|
|
134
|
-
{ value: "lambdaBody", description: "" },
|
|
135
|
-
{ value: "conditionalExpression", description: "" },
|
|
136
|
-
{ value: "binaryExpression", description: "" },
|
|
137
|
-
{ value: "unaryExpression", description: "" },
|
|
138
|
-
{ value: "unaryExpressionNotPlusMinus", description: "" },
|
|
139
|
-
{ value: "primary", description: "" },
|
|
140
|
-
{ value: "primaryPrefix", description: "" },
|
|
141
|
-
{ value: "primarySuffix", description: "" },
|
|
142
|
-
{ value: "fqnOrRefType", description: "" },
|
|
143
|
-
{ value: "fqnOrRefTypePartRest", description: "" },
|
|
144
|
-
{ value: "fqnOrRefTypePartCommon", description: "" },
|
|
145
|
-
{ value: "fqnOrRefTypePartFirst", description: "" },
|
|
146
|
-
{ value: "parenthesisExpression", description: "" },
|
|
147
|
-
{ value: "castExpression", description: "" },
|
|
148
|
-
{ value: "primitiveCastExpression", description: "" },
|
|
149
|
-
{ value: "referenceTypeCastExpression", description: "" },
|
|
150
|
-
{ value: "newExpression", description: "" },
|
|
151
|
-
{ value: "unqualifiedClassInstanceCreationExpression", description: "" },
|
|
152
|
-
{ value: "classOrInterfaceTypeToInstantiate", description: "" },
|
|
153
|
-
{ value: "typeArgumentsOrDiamond", description: "" },
|
|
154
|
-
{ value: "diamond", description: "" },
|
|
155
|
-
{ value: "methodInvocationSuffix", description: "" },
|
|
156
|
-
{ value: "argumentList", description: "" },
|
|
157
|
-
{ value: "arrayCreationExpression", description: "" },
|
|
158
|
-
{
|
|
159
|
-
value: "arrayCreationExpressionWithoutInitializerSuffix",
|
|
160
|
-
description: ""
|
|
161
|
-
},
|
|
162
|
-
{ value: "arrayCreationWithInitializerSuffix", description: "" },
|
|
163
|
-
{ value: "dimExprs", description: "" },
|
|
164
|
-
{ value: "dimExpr", description: "" },
|
|
165
|
-
{ value: "classLiteralSuffix", description: "" },
|
|
166
|
-
{ value: "arrayAccessSuffix", description: "" },
|
|
167
|
-
{ value: "methodReferenceSuffix", description: "" },
|
|
168
|
-
{ value: "templateArgument", description: "" },
|
|
169
|
-
{ value: "template", description: "" },
|
|
170
|
-
{ value: "stringTemplate", description: "" },
|
|
171
|
-
{ value: "textBlockTemplate", description: "" },
|
|
172
|
-
{ value: "embeddedExpression", description: "" },
|
|
173
|
-
{ value: "pattern", description: "" },
|
|
174
|
-
{ value: "typePattern", description: "" },
|
|
175
|
-
{ value: "recordPattern", description: "" },
|
|
176
|
-
{ value: "componentPatternList", description: "" },
|
|
177
|
-
{ value: "componentPattern", description: "" },
|
|
178
|
-
{ value: "matchAllPattern", description: "" },
|
|
179
|
-
{ value: "guard", description: "" },
|
|
180
|
-
{ value: "isRefTypeInMethodRef", description: "" },
|
|
181
|
-
{ value: "interfaceDeclaration", description: "" },
|
|
182
|
-
{ value: "normalInterfaceDeclaration", description: "" },
|
|
183
|
-
{ value: "interfaceModifier", description: "" },
|
|
184
|
-
{ value: "interfaceExtends", description: "" },
|
|
185
|
-
{ value: "interfacePermits", description: "" },
|
|
186
|
-
{ value: "interfaceBody", description: "" },
|
|
187
|
-
{ value: "interfaceMemberDeclaration", description: "" },
|
|
188
|
-
{ value: "constantDeclaration", description: "" },
|
|
189
|
-
{ value: "constantModifier", description: "" },
|
|
190
|
-
{ value: "interfaceMethodDeclaration", description: "" },
|
|
191
|
-
{ value: "interfaceMethodModifier", description: "" },
|
|
192
|
-
{ value: "annotationInterfaceDeclaration", description: "" },
|
|
193
|
-
{ value: "annotationInterfaceBody", description: "" },
|
|
194
|
-
{ value: "annotationInterfaceMemberDeclaration", description: "" },
|
|
195
|
-
{ value: "annotationInterfaceElementDeclaration", description: "" },
|
|
196
|
-
{ value: "annotationInterfaceElementModifier", description: "" },
|
|
197
|
-
{ value: "defaultValue", description: "" },
|
|
198
|
-
{ value: "annotation", description: "" },
|
|
199
|
-
{ value: "elementValuePairList", description: "" },
|
|
200
|
-
{ value: "elementValuePair", description: "" },
|
|
201
|
-
{ value: "elementValue", description: "" },
|
|
202
|
-
{ value: "elementValueArrayInitializer", description: "" },
|
|
203
|
-
{ value: "elementValueList", description: "" },
|
|
204
|
-
{ value: "literal", description: "" },
|
|
205
|
-
{ value: "integerLiteral", description: "" },
|
|
206
|
-
{ value: "floatingPointLiteral", description: "" },
|
|
207
|
-
{ value: "booleanLiteral", description: "" },
|
|
208
|
-
{ value: "shiftOperator", description: "" },
|
|
209
|
-
{ value: "moduleName", description: "" },
|
|
210
|
-
{ value: "packageName", description: "" },
|
|
211
|
-
{ value: "typeName", description: "" },
|
|
212
|
-
{ value: "expressionName", description: "" },
|
|
213
|
-
{ value: "methodName", description: "" },
|
|
214
|
-
{ value: "packageOrTypeName", description: "" },
|
|
215
|
-
{ value: "ambiguousName", description: "" },
|
|
216
|
-
{ value: "compilationUnit", description: "" },
|
|
217
|
-
{ value: "ordinaryCompilationUnit", description: "" },
|
|
218
|
-
{ value: "modularCompilationUnit", description: "" },
|
|
219
|
-
{ value: "packageDeclaration", description: "" },
|
|
220
|
-
{ value: "packageModifier", description: "" },
|
|
221
|
-
{ value: "importDeclaration", description: "" },
|
|
222
|
-
{ value: "typeDeclaration", description: "" },
|
|
223
|
-
{ value: "moduleDeclaration", description: "" },
|
|
224
|
-
{ value: "moduleDirective", description: "" },
|
|
225
|
-
{ value: "requiresModuleDirective", description: "" },
|
|
226
|
-
{ value: "exportsModuleDirective", description: "" },
|
|
227
|
-
{ value: "opensModuleDirective", description: "" },
|
|
228
|
-
{ value: "usesModuleDirective", description: "" },
|
|
229
|
-
{ value: "providesModuleDirective", description: "" },
|
|
230
|
-
{ value: "requiresModifier", description: "" },
|
|
231
|
-
{ value: "primitiveType", description: "" },
|
|
232
|
-
{ value: "numericType", description: "" },
|
|
233
|
-
{ value: "integralType", description: "" },
|
|
234
|
-
{ value: "floatingPointType", description: "" },
|
|
235
|
-
{ value: "referenceType", description: "" },
|
|
236
|
-
{ value: "classOrInterfaceType", description: "" },
|
|
237
|
-
{ value: "classType", description: "" },
|
|
238
|
-
{ value: "interfaceType", description: "" },
|
|
239
|
-
{ value: "typeVariable", description: "" },
|
|
240
|
-
{ value: "dims", description: "" },
|
|
241
|
-
{ value: "typeParameter", description: "" },
|
|
242
|
-
{ value: "typeParameterModifier", description: "" },
|
|
243
|
-
{ value: "typeBound", description: "" },
|
|
244
|
-
{ value: "additionalBound", description: "" },
|
|
245
|
-
{ value: "typeArguments", description: "" },
|
|
246
|
-
{ value: "typeArgumentList", description: "" },
|
|
247
|
-
{ value: "typeArgument", description: "" },
|
|
248
|
-
{ value: "wildcard", description: "" },
|
|
249
|
-
{ value: "wildcardBounds", description: "" }
|
|
250
|
-
],
|
|
251
|
-
description: "Prettify from the entrypoint, allowing to use prettier on snippet."
|
|
252
|
-
},
|
|
253
|
-
arrowParens: {
|
|
254
|
-
type: "choice",
|
|
255
|
-
category: "Java",
|
|
256
|
-
default: "always",
|
|
257
|
-
choices: [
|
|
258
|
-
{ value: "always", description: "" },
|
|
259
|
-
{ value: "avoid", description: "" }
|
|
260
|
-
],
|
|
261
|
-
description: "Include parentheses around a sole arrow function parameter."
|
|
262
|
-
},
|
|
263
|
-
trailingComma: {
|
|
264
|
-
type: "choice",
|
|
265
|
-
category: "Java",
|
|
266
|
-
default: "all",
|
|
267
|
-
choices: [
|
|
268
|
-
{ value: "all", description: "" },
|
|
269
|
-
{ value: "es5", description: "" },
|
|
270
|
-
{ value: "none", description: "" }
|
|
271
|
-
],
|
|
272
|
-
description: "Print trailing commas wherever possible when multi-line."
|
|
273
|
-
},
|
|
274
|
-
experimentalOperatorPosition: {
|
|
275
|
-
type: "choice",
|
|
276
|
-
category: "Java",
|
|
277
|
-
default: "end",
|
|
278
|
-
choices: [
|
|
279
|
-
{ value: "start", description: "" },
|
|
280
|
-
{ value: "end", description: "" }
|
|
281
|
-
],
|
|
282
|
-
description: "Where to print operators when binary expressions wrap lines."
|
|
283
|
-
}
|
|
284
|
-
};
|
package/dist/parser.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type JavaNode, type JavaNonTerminal, type JavaParserOptions } from "./printers/helpers.js";
|
|
2
|
-
declare const _default: {
|
|
3
|
-
parse(text: string, options: JavaParserOptions): JavaNonTerminal;
|
|
4
|
-
astFormat: string;
|
|
5
|
-
hasPragma(text: string): boolean;
|
|
6
|
-
locStart(node: JavaNode): number;
|
|
7
|
-
locEnd(node: JavaNode): number;
|
|
8
|
-
};
|
|
9
|
-
export default _default;
|
package/dist/parser.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { parse } from "java-parser";
|
|
2
|
-
import { determinePrettierIgnoreRanges } from "./comments.js";
|
|
3
|
-
import { isTerminal } from "./printers/helpers.js";
|
|
4
|
-
export default {
|
|
5
|
-
parse(text, options) {
|
|
6
|
-
var _a;
|
|
7
|
-
const cst = parse(text, options.entrypoint);
|
|
8
|
-
(_a = cst.comments) === null || _a === void 0 ? void 0 : _a.forEach(comment => {
|
|
9
|
-
comment.value = comment.image;
|
|
10
|
-
});
|
|
11
|
-
determinePrettierIgnoreRanges(cst);
|
|
12
|
-
return cst;
|
|
13
|
-
},
|
|
14
|
-
astFormat: "java",
|
|
15
|
-
hasPragma(text) {
|
|
16
|
-
return /^\/\*\*\n\s+\*\s@(format|prettier)\n\s+\*\//.test(text);
|
|
17
|
-
},
|
|
18
|
-
locStart(node) {
|
|
19
|
-
return isTerminal(node) ? node.startOffset : node.location.startOffset;
|
|
20
|
-
},
|
|
21
|
-
locEnd(node) {
|
|
22
|
-
return (isTerminal(node) ? node.endOffset : node.location.endOffset) + 1;
|
|
23
|
-
}
|
|
24
|
-
};
|
package/dist/printer.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { AstPath } from "prettier";
|
|
2
|
-
import { canAttachComment, handleLineComment, handleRemainingComment } from "./comments.js";
|
|
3
|
-
import { type JavaNode } from "./printers/helpers.js";
|
|
4
|
-
declare const _default: {
|
|
5
|
-
print(path: DistributedAstPath<JavaNode>, options: import("prettier").ParserOptions<JavaNode>, print: (path: AstPath<JavaNode>) => import("prettier").Doc, args: unknown): import("prettier/doc.js").builders.Doc;
|
|
6
|
-
hasPrettierIgnore(path: AstPath<JavaNode>): boolean;
|
|
7
|
-
canAttachComment: typeof canAttachComment;
|
|
8
|
-
isBlockComment(node: JavaNode): boolean;
|
|
9
|
-
printComment(commentPath: AstPath<JavaNode>): string | import("prettier/doc.js").builders.Doc[];
|
|
10
|
-
getCommentChildNodes(node: JavaNode): any[];
|
|
11
|
-
handleComments: {
|
|
12
|
-
ownLine: typeof handleLineComment;
|
|
13
|
-
endOfLine: typeof handleLineComment;
|
|
14
|
-
remaining: typeof handleRemainingComment;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
export default _default;
|
|
18
|
-
type DistributedAstPath<T> = T extends any ? AstPath<T> : never;
|
package/dist/printer.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { canAttachComment, handleLineComment, handleRemainingComment, isFullyBetweenPrettierIgnore } from "./comments.js";
|
|
2
|
-
import { isNonTerminal, isTerminal, printComment } from "./printers/helpers.js";
|
|
3
|
-
import { printerForNodeType } from "./printers/index.js";
|
|
4
|
-
export default {
|
|
5
|
-
print(path, options, print, args) {
|
|
6
|
-
return hasTerminal(path)
|
|
7
|
-
? path.node.image
|
|
8
|
-
: printerForNodeType(path.node.name)(path, print, options, args);
|
|
9
|
-
},
|
|
10
|
-
hasPrettierIgnore(path) {
|
|
11
|
-
var _a;
|
|
12
|
-
const { node } = path;
|
|
13
|
-
return (((_a = node.comments) === null || _a === void 0 ? void 0 : _a.some(({ image }) => /^(\/\/\s*prettier-ignore|\/\*\s*prettier-ignore\s*\*\/)$/.test(image))) === true ||
|
|
14
|
-
(canAttachComment(node) && isFullyBetweenPrettierIgnore(path)));
|
|
15
|
-
},
|
|
16
|
-
canAttachComment,
|
|
17
|
-
isBlockComment(node) {
|
|
18
|
-
return isTerminal(node) && node.tokenType.name === "TraditionalComment";
|
|
19
|
-
},
|
|
20
|
-
printComment(commentPath) {
|
|
21
|
-
const { node } = commentPath;
|
|
22
|
-
if (isNonTerminal(node) || node.tokenType.GROUP !== "comments") {
|
|
23
|
-
throw new Error(`Not a comment: ${JSON.stringify(node)}`);
|
|
24
|
-
}
|
|
25
|
-
return printComment(node);
|
|
26
|
-
},
|
|
27
|
-
getCommentChildNodes(node) {
|
|
28
|
-
return isNonTerminal(node)
|
|
29
|
-
? Object.values(node.children).flatMap(child => child)
|
|
30
|
-
: [];
|
|
31
|
-
},
|
|
32
|
-
handleComments: {
|
|
33
|
-
ownLine: handleLineComment,
|
|
34
|
-
endOfLine: handleLineComment,
|
|
35
|
-
remaining: handleRemainingComment
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
function hasTerminal(path) {
|
|
39
|
-
return isTerminal(path.node);
|
|
40
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
arrayInitializer(path: import("prettier").AstPath<import("java-parser").ArrayInitializerCstNode & {
|
|
3
|
-
comments?: import("../comments.js").JavaComment[];
|
|
4
|
-
}>, print: import("./helpers.js").JavaPrintFn, options: import("./helpers.js").JavaParserOptions): import("prettier/doc.js").builders.Group | (string | import("prettier/doc.js").builders.Indent | import("prettier/doc.js").builders.Hardline)[] | "{}";
|
|
5
|
-
variableInitializerList(path: import("prettier").AstPath<import("java-parser").VariableInitializerListCstNode & {
|
|
6
|
-
comments?: import("../comments.js").JavaComment[];
|
|
7
|
-
}>, print: import("./helpers.js").JavaPrintFn): import("prettier/doc.js").builders.Doc[];
|
|
8
|
-
};
|
|
9
|
-
export default _default;
|
package/dist/printers/arrays.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { printArrayInitializer, printList } from "./helpers.js";
|
|
2
|
-
export default {
|
|
3
|
-
arrayInitializer(path, print, options) {
|
|
4
|
-
return printArrayInitializer(path, print, options, "variableInitializerList");
|
|
5
|
-
},
|
|
6
|
-
variableInitializerList(path, print) {
|
|
7
|
-
return printList(path, print, "variableInitializer");
|
|
8
|
-
}
|
|
9
|
-
};
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { builders } from "prettier/doc";
|
|
2
|
-
import { printSingle } from "./helpers.js";
|
|
3
|
-
declare const _default: {
|
|
4
|
-
block(path: import("prettier").AstPath<import("java-parser").BlockCstNode & {
|
|
5
|
-
comments?: import("../comments.js").JavaComment[];
|
|
6
|
-
}>, print: import("./helpers.js").JavaPrintFn): builders.Group | (string | builders.Indent | builders.Hardline)[] | "{}";
|
|
7
|
-
blockStatements(path: import("prettier").AstPath<import("java-parser").BlockStatementsCstNode & {
|
|
8
|
-
comments?: import("../comments.js").JavaComment[];
|
|
9
|
-
}>, print: import("./helpers.js").JavaPrintFn): builders.Doc[];
|
|
10
|
-
blockStatement: typeof printSingle;
|
|
11
|
-
localVariableDeclarationStatement(path: import("prettier").AstPath<import("java-parser").LocalVariableDeclarationStatementCstNode & {
|
|
12
|
-
comments?: import("../comments.js").JavaComment[];
|
|
13
|
-
}>, print: import("./helpers.js").JavaPrintFn): builders.Doc[];
|
|
14
|
-
localVariableDeclaration(path: import("prettier").AstPath<import("java-parser").LocalVariableDeclarationCstNode & {
|
|
15
|
-
comments?: import("../comments.js").JavaComment[];
|
|
16
|
-
}>, print: import("./helpers.js").JavaPrintFn): builders.Doc[];
|
|
17
|
-
localVariableType: typeof printSingle;
|
|
18
|
-
statement: typeof printSingle;
|
|
19
|
-
statementWithoutTrailingSubstatement: typeof printSingle;
|
|
20
|
-
emptyStatement(): string;
|
|
21
|
-
labeledStatement(path: import("prettier").AstPath<import("java-parser").LabeledStatementCstNode & {
|
|
22
|
-
comments?: import("../comments.js").JavaComment[];
|
|
23
|
-
}>, print: import("./helpers.js").JavaPrintFn): builders.Doc[];
|
|
24
|
-
expressionStatement(path: import("prettier").AstPath<import("java-parser").ExpressionStatementCstNode & {
|
|
25
|
-
comments?: import("../comments.js").JavaComment[];
|
|
26
|
-
}>, print: import("./helpers.js").JavaPrintFn): builders.Doc[];
|
|
27
|
-
statementExpression: typeof printSingle;
|
|
28
|
-
ifStatement(path: import("prettier").AstPath<import("java-parser").IfStatementCstNode & {
|
|
29
|
-
comments?: import("../comments.js").JavaComment[];
|
|
30
|
-
}>, print: import("./helpers.js").JavaPrintFn): builders.Doc[];
|
|
31
|
-
assertStatement(path: import("prettier").AstPath<import("java-parser").AssertStatementCstNode & {
|
|
32
|
-
comments?: import("../comments.js").JavaComment[];
|
|
33
|
-
}>, print: import("./helpers.js").JavaPrintFn): builders.Doc[];
|
|
34
|
-
switchStatement(path: import("prettier").AstPath<import("java-parser").SwitchStatementCstNode & {
|
|
35
|
-
comments?: import("../comments.js").JavaComment[];
|
|
36
|
-
}>, print: import("./helpers.js").JavaPrintFn): builders.Doc[];
|
|
37
|
-
switchBlock(path: import("prettier").AstPath<import("java-parser").SwitchBlockCstNode & {
|
|
38
|
-
comments?: import("../comments.js").JavaComment[];
|
|
39
|
-
}>, print: import("./helpers.js").JavaPrintFn): builders.Group | (string | builders.Indent | builders.Hardline)[] | "{}";
|
|
40
|
-
switchBlockStatementGroup(path: import("prettier").AstPath<import("java-parser").SwitchBlockStatementGroupCstNode & {
|
|
41
|
-
comments?: import("../comments.js").JavaComment[];
|
|
42
|
-
}>, print: import("./helpers.js").JavaPrintFn): builders.Doc[];
|
|
43
|
-
switchLabel(path: import("prettier").AstPath<import("java-parser").SwitchLabelCstNode & {
|
|
44
|
-
comments?: import("../comments.js").JavaComment[];
|
|
45
|
-
}>, print: import("./helpers.js").JavaPrintFn): "default" | builders.Group | builders.Doc[];
|
|
46
|
-
switchRule(path: import("prettier").AstPath<import("java-parser").SwitchRuleCstNode & {
|
|
47
|
-
comments?: import("../comments.js").JavaComment[];
|
|
48
|
-
}>, print: import("./helpers.js").JavaPrintFn): builders.Doc[];
|
|
49
|
-
caseConstant: typeof printSingle;
|
|
50
|
-
casePattern: typeof printSingle;
|
|
51
|
-
whileStatement(path: import("prettier").AstPath<import("java-parser").WhileStatementCstNode & {
|
|
52
|
-
comments?: import("../comments.js").JavaComment[];
|
|
53
|
-
}>, print: import("./helpers.js").JavaPrintFn): builders.Doc[];
|
|
54
|
-
doStatement(path: import("prettier").AstPath<import("java-parser").DoStatementCstNode & {
|
|
55
|
-
comments?: import("../comments.js").JavaComment[];
|
|
56
|
-
}>, print: import("./helpers.js").JavaPrintFn): (string | builders.Group | builders.Doc[])[];
|
|
57
|
-
forStatement: typeof printSingle;
|
|
58
|
-
basicForStatement(path: import("prettier").AstPath<import("java-parser").BasicForStatementCstNode & {
|
|
59
|
-
comments?: import("../comments.js").JavaComment[];
|
|
60
|
-
}>, print: import("./helpers.js").JavaPrintFn): builders.Doc[];
|
|
61
|
-
forInit: typeof printSingle;
|
|
62
|
-
forUpdate: typeof printSingle;
|
|
63
|
-
statementExpressionList(path: import("prettier").AstPath<import("java-parser").StatementExpressionListCstNode & {
|
|
64
|
-
comments?: import("../comments.js").JavaComment[];
|
|
65
|
-
}>, print: import("./helpers.js").JavaPrintFn): builders.Group;
|
|
66
|
-
enhancedForStatement(path: import("prettier").AstPath<import("java-parser").EnhancedForStatementCstNode & {
|
|
67
|
-
comments?: import("../comments.js").JavaComment[];
|
|
68
|
-
}>, print: import("./helpers.js").JavaPrintFn): builders.Group;
|
|
69
|
-
breakStatement(path: import("prettier").AstPath<import("java-parser").BreakStatementCstNode & {
|
|
70
|
-
comments?: import("../comments.js").JavaComment[];
|
|
71
|
-
}>, print: import("./helpers.js").JavaPrintFn): builders.Doc[] | "break;";
|
|
72
|
-
continueStatement(path: import("prettier").AstPath<import("java-parser").ContinueStatementCstNode & {
|
|
73
|
-
comments?: import("../comments.js").JavaComment[];
|
|
74
|
-
}>, print: import("./helpers.js").JavaPrintFn): builders.Doc[] | "continue;";
|
|
75
|
-
returnStatement(path: import("prettier").AstPath<import("java-parser").ReturnStatementCstNode & {
|
|
76
|
-
comments?: import("../comments.js").JavaComment[];
|
|
77
|
-
}>, print: import("./helpers.js").JavaPrintFn): builders.Doc[];
|
|
78
|
-
throwStatement(path: import("prettier").AstPath<import("java-parser").ThrowStatementCstNode & {
|
|
79
|
-
comments?: import("../comments.js").JavaComment[];
|
|
80
|
-
}>, print: import("./helpers.js").JavaPrintFn): builders.Doc[];
|
|
81
|
-
synchronizedStatement(path: import("prettier").AstPath<import("java-parser").SynchronizedStatementCstNode & {
|
|
82
|
-
comments?: import("../comments.js").JavaComment[];
|
|
83
|
-
}>, print: import("./helpers.js").JavaPrintFn): builders.Doc[];
|
|
84
|
-
tryStatement(path: import("prettier").AstPath<import("java-parser").TryStatementCstNode & {
|
|
85
|
-
comments?: import("../comments.js").JavaComment[];
|
|
86
|
-
}>, print: import("./helpers.js").JavaPrintFn): builders.Doc;
|
|
87
|
-
catches(path: import("prettier").AstPath<import("java-parser").CatchesCstNode & {
|
|
88
|
-
comments?: import("../comments.js").JavaComment[];
|
|
89
|
-
}>, print: import("./helpers.js").JavaPrintFn): builders.Doc[];
|
|
90
|
-
catchClause(path: import("prettier").AstPath<import("java-parser").CatchClauseCstNode & {
|
|
91
|
-
comments?: import("../comments.js").JavaComment[];
|
|
92
|
-
}>, print: import("./helpers.js").JavaPrintFn): builders.Doc[];
|
|
93
|
-
catchFormalParameter(path: import("prettier").AstPath<import("java-parser").CatchFormalParameterCstNode & {
|
|
94
|
-
comments?: import("../comments.js").JavaComment[];
|
|
95
|
-
}>, print: import("./helpers.js").JavaPrintFn): builders.Doc[];
|
|
96
|
-
catchType(path: import("prettier").AstPath<import("java-parser").CatchTypeCstNode & {
|
|
97
|
-
comments?: import("../comments.js").JavaComment[];
|
|
98
|
-
}>, print: import("./helpers.js").JavaPrintFn): builders.Doc[];
|
|
99
|
-
finally(path: import("prettier").AstPath<import("java-parser").FinallyCstNode & {
|
|
100
|
-
comments?: import("../comments.js").JavaComment[];
|
|
101
|
-
}>, print: import("./helpers.js").JavaPrintFn): builders.Doc[];
|
|
102
|
-
tryWithResourcesStatement(path: import("prettier").AstPath<import("java-parser").TryWithResourcesStatementCstNode & {
|
|
103
|
-
comments?: import("../comments.js").JavaComment[];
|
|
104
|
-
}>, print: import("./helpers.js").JavaPrintFn): builders.Doc[];
|
|
105
|
-
resourceSpecification(path: import("prettier").AstPath<import("java-parser").ResourceSpecificationCstNode & {
|
|
106
|
-
comments?: import("../comments.js").JavaComment[];
|
|
107
|
-
}>, print: import("./helpers.js").JavaPrintFn): builders.Group | "()";
|
|
108
|
-
resourceList(path: import("prettier").AstPath<import("java-parser").ResourceListCstNode & {
|
|
109
|
-
comments?: import("../comments.js").JavaComment[];
|
|
110
|
-
}>, print: import("./helpers.js").JavaPrintFn): builders.Doc[];
|
|
111
|
-
resource: typeof printSingle;
|
|
112
|
-
yieldStatement(path: import("prettier").AstPath<import("java-parser").YieldStatementCstNode & {
|
|
113
|
-
comments?: import("../comments.js").JavaComment[];
|
|
114
|
-
}>, print: import("./helpers.js").JavaPrintFn): builders.Doc[];
|
|
115
|
-
variableAccess: typeof printSingle;
|
|
116
|
-
};
|
|
117
|
-
export default _default;
|