prettier-plugin-java 2.3.1 → 2.5.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/options.js +5 -4
- package/dist/printers/blocks-and-statements.js +23 -40
- package/dist/printers/classes.js +3 -0
- package/dist/printers/expressions.js +26 -18
- package/package.json +3 -3
- package/dist/src/base-cst-printer.js +0 -77
- package/dist/src/cst-printer.js +0 -37
- package/dist/src/index.js +0 -67
- package/dist/src/options.js +0 -256
- package/dist/src/parser.js +0 -7
- package/dist/src/printer.js +0 -28
- package/dist/src/printers/arrays.js +0 -49
- package/dist/src/printers/blocks-and-statements.js +0 -493
- package/dist/src/printers/classes.js +0 -724
- package/dist/src/printers/comments/comments-utils.js +0 -29
- package/dist/src/printers/comments/format-comments.js +0 -187
- package/dist/src/printers/comments/handle-comments.js +0 -38
- package/dist/src/printers/expressions.js +0 -549
- package/dist/src/printers/interfaces.js +0 -251
- package/dist/src/printers/lexical-structure.js +0 -43
- package/dist/src/printers/names.js +0 -53
- package/dist/src/printers/packages-and-modules.js +0 -185
- package/dist/src/printers/prettier-builder.js +0 -47
- package/dist/src/printers/printer-utils.js +0 -577
- package/dist/src/printers/types-values-and-variables.js +0 -183
- package/dist/src/types/utils.js +0 -29
- package/dist/src/utils/expressions-utils.js +0 -29
- package/dist/src/utils/index.js +0 -10
- package/dist/src/utils/printArgumentListWithBraces.js +0 -21
- package/dist/src/utils/printSingleLambdaInvocation.js +0 -20
- package/dist/test/babel-register.js +0 -3
- package/dist/test/repository-test/core-test.js +0 -12
- package/dist/test/repository-test/jhipster-1-test.js +0 -17
- package/dist/test/repository-test/jhipster-2-test.js +0 -16
- package/dist/test/test-utils.js +0 -215
- package/dist/test/unit-test/annotation_type_declaration/annotation_type_declaration-spec.js +0 -6
- package/dist/test/unit-test/args/args-spec.js +0 -6
- package/dist/test/unit-test/assert/assert-spec.js +0 -6
- package/dist/test/unit-test/binary_expressions/binary_expressions-spec.js +0 -6
- package/dist/test/unit-test/blank_lines/blank_lines-spec.js +0 -6
- package/dist/test/unit-test/bug-fixes/bug-fixes-spec.js +0 -6
- package/dist/test/unit-test/cast/cast-spec.js +0 -6
- package/dist/test/unit-test/char_literal/char_literal-spec.js +0 -6
- package/dist/test/unit-test/classes/multiple_classes-spec.js +0 -6
- package/dist/test/unit-test/comments/comments-spec.js +0 -14
- package/dist/test/unit-test/complex_generic_class/complex_generic_class-spec.js +0 -6
- package/dist/test/unit-test/constructors/constructors-spec.js +0 -6
- package/dist/test/unit-test/empty_statement/empty_statement-spec.js +0 -6
- package/dist/test/unit-test/enum/enum-spec.js +0 -6
- package/dist/test/unit-test/expressions/expressions-spec.js +0 -6
- package/dist/test/unit-test/extends_abstract_class/extends_abstract_class-spec.js +0 -6
- package/dist/test/unit-test/extends_abstract_class_and_implements_interfaces/extends_abstract_class_and_implements_interfaces-spec.js +0 -6
- package/dist/test/unit-test/for/for-spec.js +0 -6
- package/dist/test/unit-test/generic_class/generic_class-spec.js +0 -6
- package/dist/test/unit-test/generic_questionmark/generic_questionmark-spec.js +0 -6
- package/dist/test/unit-test/hello-world/hello-word-spec.js +0 -6
- package/dist/test/unit-test/if/if-spec.js +0 -6
- package/dist/test/unit-test/indent/indent-spec.js +0 -6
- package/dist/test/unit-test/instantiation/instantiation-spec.js +0 -6
- package/dist/test/unit-test/interface/interface-spec.js +0 -6
- package/dist/test/unit-test/lambda/lambda-spec.js +0 -6
- package/dist/test/unit-test/marker_annotations/marker_annotations-spec.js +0 -6
- package/dist/test/unit-test/member_chain/member_chain-spec.js +0 -6
- package/dist/test/unit-test/method_reference/method_reference-spec.js +0 -6
- package/dist/test/unit-test/modifiers/modifiers-spec.js +0 -6
- package/dist/test/unit-test/modules/modules-spec.js +0 -6
- package/dist/test/unit-test/package_and_imports/package_and_imports-spec.js +0 -34
- package/dist/test/unit-test/pattern-matching/pattern-matching-spec.js +0 -6
- package/dist/test/unit-test/prettier-ignore/prettier-ignore-spec.js +0 -28
- package/dist/test/unit-test/records/records-spec.js +0 -6
- package/dist/test/unit-test/return/return-spec.js +0 -6
- package/dist/test/unit-test/sealed/sealed-spec.js +0 -6
- package/dist/test/unit-test/snippets/arrays/array-initializer.spec.js +0 -94
- package/dist/test/unit-test/snippets/arrays/variable-initializer-list.spec.js +0 -19
- package/dist/test/unit-test/snippets/blocks-and-statements/switch.spec.js +0 -26
- package/dist/test/unit-test/snippets/classes/class-body.spec.js +0 -181
- package/dist/test/unit-test/snippets/classes/enum-body.spec.js +0 -87
- package/dist/test/unit-test/snippets/classes/variableDeclarator/test.spec.js +0 -186
- package/dist/test/unit-test/snippets/interfaces/element-value-array-initializer.spec.js +0 -85
- package/dist/test/unit-test/snippets/names/ambiguousName/test.spec.js +0 -19
- package/dist/test/unit-test/snippets/names/expressionName/test.spec.js +0 -19
- package/dist/test/unit-test/snippets/names/methodName/test.spec.js +0 -12
- package/dist/test/unit-test/snippets/names/packageOrTypeName/test.spec.js +0 -19
- package/dist/test/unit-test/snippets/types-values-and-variables/floatingPointType/test.spec.js +0 -19
- package/dist/test/unit-test/snippets/types-values-and-variables/integralType/test.spec.js +0 -40
- package/dist/test/unit-test/snippets/types-values-and-variables/numericType/test.spec.js +0 -88
- package/dist/test/unit-test/snippets/types-values-and-variables/wildcard/test.spec.js +0 -112
- package/dist/test/unit-test/snippets/types-values-and-variables/wildcardBounds/test.spec.js +0 -81
- package/dist/test/unit-test/switch/switch-spec.js +0 -6
- package/dist/test/unit-test/synchronized/synchronized-spec.js +0 -6
- package/dist/test/unit-test/text-blocks/text-block-spec.js +0 -6
- package/dist/test/unit-test/throws/throws-spec.js +0 -6
- package/dist/test/unit-test/try_catch/try_catch-spec.js +0 -6
- package/dist/test/unit-test/types/types-spec.js +0 -6
- package/dist/test/unit-test/variables/variables-spec.js +0 -6
- package/dist/test/unit-test/while/while-spec.js +0 -6
- package/dist/test/unit-test/yield-statement/yield-statement-spec.js +0 -6
|
@@ -1,251 +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.InterfacesPrettierVisitor = void 0;
|
|
19
|
-
var prettier_builder_1 = require("./prettier-builder");
|
|
20
|
-
var format_comments_1 = require("./comments/format-comments");
|
|
21
|
-
var printer_utils_1 = require("./printer-utils");
|
|
22
|
-
var doc_1 = require("prettier/doc");
|
|
23
|
-
var base_cst_printer_1 = require("../base-cst-printer");
|
|
24
|
-
var line = doc_1.builders.line, softline = doc_1.builders.softline, hardline = doc_1.builders.hardline;
|
|
25
|
-
var InterfacesPrettierVisitor = /** @class */ (function (_super) {
|
|
26
|
-
__extends(InterfacesPrettierVisitor, _super);
|
|
27
|
-
function InterfacesPrettierVisitor() {
|
|
28
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
29
|
-
}
|
|
30
|
-
InterfacesPrettierVisitor.prototype.interfaceDeclaration = function (ctx) {
|
|
31
|
-
var modifiers = printer_utils_1.sortModifiers(ctx.interfaceModifier);
|
|
32
|
-
var firstAnnotations = this.mapVisit(modifiers[0]);
|
|
33
|
-
var otherModifiers = this.mapVisit(modifiers[1]);
|
|
34
|
-
var declaration = ctx.normalInterfaceDeclaration
|
|
35
|
-
? this.visit(ctx.normalInterfaceDeclaration)
|
|
36
|
-
: this.visit(ctx.annotationTypeDeclaration);
|
|
37
|
-
return printer_utils_1.rejectAndJoin(hardline, [
|
|
38
|
-
printer_utils_1.rejectAndJoin(hardline, firstAnnotations),
|
|
39
|
-
printer_utils_1.rejectAndJoin(" ", [printer_utils_1.rejectAndJoin(" ", otherModifiers), declaration])
|
|
40
|
-
]);
|
|
41
|
-
};
|
|
42
|
-
InterfacesPrettierVisitor.prototype.normalInterfaceDeclaration = function (ctx) {
|
|
43
|
-
var typeIdentifier = this.visit(ctx.typeIdentifier);
|
|
44
|
-
var typeParameters = this.visit(ctx.typeParameters);
|
|
45
|
-
var extendsInterfaces = this.visit(ctx.extendsInterfaces);
|
|
46
|
-
var optionalInterfacePermits = this.visit(ctx.interfacePermits);
|
|
47
|
-
var interfaceBody = this.visit(ctx.interfaceBody);
|
|
48
|
-
var extendsInterfacesPart = "";
|
|
49
|
-
if (extendsInterfaces) {
|
|
50
|
-
extendsInterfacesPart = prettier_builder_1.indent(printer_utils_1.rejectAndConcat([softline, extendsInterfaces]));
|
|
51
|
-
}
|
|
52
|
-
var interfacePermits = "";
|
|
53
|
-
if (optionalInterfacePermits) {
|
|
54
|
-
interfacePermits = prettier_builder_1.indent(printer_utils_1.rejectAndConcat([softline, optionalInterfacePermits]));
|
|
55
|
-
}
|
|
56
|
-
return printer_utils_1.rejectAndJoin(" ", [
|
|
57
|
-
prettier_builder_1.group(printer_utils_1.rejectAndJoin(" ", [
|
|
58
|
-
ctx.Interface[0],
|
|
59
|
-
prettier_builder_1.concat([typeIdentifier, typeParameters]),
|
|
60
|
-
extendsInterfacesPart,
|
|
61
|
-
interfacePermits
|
|
62
|
-
])),
|
|
63
|
-
interfaceBody
|
|
64
|
-
]);
|
|
65
|
-
};
|
|
66
|
-
InterfacesPrettierVisitor.prototype.interfaceModifier = function (ctx) {
|
|
67
|
-
if (ctx.annotation) {
|
|
68
|
-
return this.visitSingle(ctx);
|
|
69
|
-
}
|
|
70
|
-
return format_comments_1.printTokenWithComments(this.getSingle(ctx));
|
|
71
|
-
};
|
|
72
|
-
InterfacesPrettierVisitor.prototype.extendsInterfaces = function (ctx) {
|
|
73
|
-
var interfaceTypeList = this.visit(ctx.interfaceTypeList);
|
|
74
|
-
return prettier_builder_1.group(printer_utils_1.rejectAndConcat([
|
|
75
|
-
ctx.Extends[0],
|
|
76
|
-
prettier_builder_1.indent(printer_utils_1.rejectAndConcat([line, interfaceTypeList]))
|
|
77
|
-
]));
|
|
78
|
-
};
|
|
79
|
-
InterfacesPrettierVisitor.prototype.interfacePermits = function (ctx) {
|
|
80
|
-
return this.classPermits(ctx);
|
|
81
|
-
};
|
|
82
|
-
InterfacesPrettierVisitor.prototype.interfaceBody = function (ctx) {
|
|
83
|
-
var joinedInterfaceMemberDeclaration = "";
|
|
84
|
-
if (ctx.interfaceMemberDeclaration !== undefined) {
|
|
85
|
-
var interfaceMemberDeclaration = this.mapVisit(ctx.interfaceMemberDeclaration);
|
|
86
|
-
var separators = printer_utils_1.getInterfaceBodyDeclarationsSeparator(ctx.interfaceMemberDeclaration);
|
|
87
|
-
joinedInterfaceMemberDeclaration = printer_utils_1.rejectAndJoinSeps(separators, interfaceMemberDeclaration);
|
|
88
|
-
}
|
|
89
|
-
return printer_utils_1.putIntoBraces(joinedInterfaceMemberDeclaration, hardline, ctx.LCurly[0], ctx.RCurly[0]);
|
|
90
|
-
};
|
|
91
|
-
InterfacesPrettierVisitor.prototype.interfaceMemberDeclaration = function (ctx) {
|
|
92
|
-
if (ctx.Semicolon) {
|
|
93
|
-
return printer_utils_1.displaySemicolon(ctx.Semicolon[0]);
|
|
94
|
-
}
|
|
95
|
-
return this.visitSingle(ctx);
|
|
96
|
-
};
|
|
97
|
-
InterfacesPrettierVisitor.prototype.constantDeclaration = function (ctx) {
|
|
98
|
-
var modifiers = printer_utils_1.sortModifiers(ctx.constantModifier);
|
|
99
|
-
var firstAnnotations = this.mapVisit(modifiers[0]);
|
|
100
|
-
var otherModifiers = this.mapVisit(modifiers[1]);
|
|
101
|
-
var unannType = this.visit(ctx.unannType);
|
|
102
|
-
var variableDeclaratorList = this.visit(ctx.variableDeclaratorList);
|
|
103
|
-
return printer_utils_1.rejectAndJoin(hardline, [
|
|
104
|
-
printer_utils_1.rejectAndJoin(hardline, firstAnnotations),
|
|
105
|
-
printer_utils_1.rejectAndJoin(" ", [
|
|
106
|
-
printer_utils_1.rejectAndJoin(" ", otherModifiers),
|
|
107
|
-
unannType,
|
|
108
|
-
printer_utils_1.rejectAndConcat([variableDeclaratorList, ctx.Semicolon[0]])
|
|
109
|
-
])
|
|
110
|
-
]);
|
|
111
|
-
};
|
|
112
|
-
InterfacesPrettierVisitor.prototype.constantModifier = function (ctx) {
|
|
113
|
-
if (ctx.annotation) {
|
|
114
|
-
return this.visitSingle(ctx);
|
|
115
|
-
}
|
|
116
|
-
return format_comments_1.printTokenWithComments(this.getSingle(ctx));
|
|
117
|
-
};
|
|
118
|
-
InterfacesPrettierVisitor.prototype.interfaceMethodDeclaration = function (ctx) {
|
|
119
|
-
var modifiers = printer_utils_1.sortModifiers(ctx.interfaceMethodModifier);
|
|
120
|
-
var firstAnnotations = this.mapVisit(modifiers[0]);
|
|
121
|
-
var otherModifiers = this.mapVisit(modifiers[1]);
|
|
122
|
-
var methodHeader = this.visit(ctx.methodHeader);
|
|
123
|
-
var methodBody = this.visit(ctx.methodBody);
|
|
124
|
-
var separator = printer_utils_1.isStatementEmptyStatement(methodBody) ? "" : " ";
|
|
125
|
-
return printer_utils_1.rejectAndJoin(hardline, [
|
|
126
|
-
printer_utils_1.rejectAndJoin(hardline, firstAnnotations),
|
|
127
|
-
printer_utils_1.rejectAndJoin(" ", [
|
|
128
|
-
printer_utils_1.rejectAndJoin(" ", otherModifiers),
|
|
129
|
-
printer_utils_1.rejectAndJoin(separator, [methodHeader, methodBody])
|
|
130
|
-
])
|
|
131
|
-
]);
|
|
132
|
-
};
|
|
133
|
-
InterfacesPrettierVisitor.prototype.interfaceMethodModifier = function (ctx) {
|
|
134
|
-
if (ctx.annotation) {
|
|
135
|
-
return this.visitSingle(ctx);
|
|
136
|
-
}
|
|
137
|
-
return format_comments_1.printTokenWithComments(this.getSingle(ctx));
|
|
138
|
-
};
|
|
139
|
-
InterfacesPrettierVisitor.prototype.annotationTypeDeclaration = function (ctx) {
|
|
140
|
-
var typeIdentifier = this.visit(ctx.typeIdentifier);
|
|
141
|
-
var annotationTypeBody = this.visit(ctx.annotationTypeBody);
|
|
142
|
-
return printer_utils_1.rejectAndJoin(" ", [
|
|
143
|
-
prettier_builder_1.concat([ctx.At[0], ctx.Interface[0]]),
|
|
144
|
-
typeIdentifier,
|
|
145
|
-
annotationTypeBody
|
|
146
|
-
]);
|
|
147
|
-
};
|
|
148
|
-
InterfacesPrettierVisitor.prototype.annotationTypeBody = function (ctx) {
|
|
149
|
-
var annotationTypeMemberDeclaration = this.mapVisit(ctx.annotationTypeMemberDeclaration);
|
|
150
|
-
return printer_utils_1.rejectAndJoin(line, [
|
|
151
|
-
prettier_builder_1.indent(printer_utils_1.rejectAndJoin(line, [
|
|
152
|
-
ctx.LCurly[0],
|
|
153
|
-
printer_utils_1.rejectAndJoin(prettier_builder_1.concat([line, line]), annotationTypeMemberDeclaration)
|
|
154
|
-
])),
|
|
155
|
-
ctx.RCurly[0]
|
|
156
|
-
]);
|
|
157
|
-
};
|
|
158
|
-
InterfacesPrettierVisitor.prototype.annotationTypeMemberDeclaration = function (ctx) {
|
|
159
|
-
if (ctx.Semicolon) {
|
|
160
|
-
return format_comments_1.printTokenWithComments(this.getSingle(ctx));
|
|
161
|
-
}
|
|
162
|
-
return this.visitSingle(ctx);
|
|
163
|
-
};
|
|
164
|
-
InterfacesPrettierVisitor.prototype.annotationTypeElementDeclaration = function (ctx) {
|
|
165
|
-
var modifiers = printer_utils_1.sortModifiers(ctx.annotationTypeElementModifier);
|
|
166
|
-
var firstAnnotations = this.mapVisit(modifiers[0]);
|
|
167
|
-
var otherModifiers = this.mapVisit(modifiers[1]);
|
|
168
|
-
var unannType = this.visit(ctx.unannType);
|
|
169
|
-
var identifier = ctx.Identifier[0];
|
|
170
|
-
var dims = this.visit(ctx.dims);
|
|
171
|
-
var defaultValue = ctx.defaultValue
|
|
172
|
-
? prettier_builder_1.concat([" ", this.visit(ctx.defaultValue)])
|
|
173
|
-
: "";
|
|
174
|
-
return printer_utils_1.rejectAndJoin(hardline, [
|
|
175
|
-
printer_utils_1.rejectAndJoin(hardline, firstAnnotations),
|
|
176
|
-
printer_utils_1.rejectAndJoin(" ", [
|
|
177
|
-
printer_utils_1.rejectAndJoin(" ", otherModifiers),
|
|
178
|
-
unannType,
|
|
179
|
-
printer_utils_1.rejectAndConcat([
|
|
180
|
-
identifier,
|
|
181
|
-
prettier_builder_1.concat([ctx.LBrace[0], ctx.RBrace[0]]),
|
|
182
|
-
dims,
|
|
183
|
-
defaultValue,
|
|
184
|
-
ctx.Semicolon[0]
|
|
185
|
-
])
|
|
186
|
-
])
|
|
187
|
-
]);
|
|
188
|
-
};
|
|
189
|
-
InterfacesPrettierVisitor.prototype.annotationTypeElementModifier = function (ctx) {
|
|
190
|
-
if (ctx.annotation) {
|
|
191
|
-
return this.visitSingle(ctx);
|
|
192
|
-
}
|
|
193
|
-
return format_comments_1.printTokenWithComments(this.getSingle(ctx));
|
|
194
|
-
};
|
|
195
|
-
InterfacesPrettierVisitor.prototype.defaultValue = function (ctx) {
|
|
196
|
-
var elementValue = this.visit(ctx.elementValue);
|
|
197
|
-
return printer_utils_1.rejectAndJoin(" ", [ctx.Default[0], elementValue]);
|
|
198
|
-
};
|
|
199
|
-
InterfacesPrettierVisitor.prototype.annotation = function (ctx) {
|
|
200
|
-
var fqn = this.visit(ctx.typeName);
|
|
201
|
-
var annoArgs = "";
|
|
202
|
-
if (ctx.LBrace) {
|
|
203
|
-
if (ctx.elementValuePairList) {
|
|
204
|
-
annoArgs = printer_utils_1.putIntoBraces(this.visit(ctx.elementValuePairList), softline, ctx.LBrace[0], ctx.RBrace[0]);
|
|
205
|
-
}
|
|
206
|
-
else if (ctx.elementValue) {
|
|
207
|
-
annoArgs = printer_utils_1.putIntoBraces(this.visit(ctx.elementValue), softline, ctx.LBrace[0], ctx.RBrace[0]);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
return prettier_builder_1.group(printer_utils_1.rejectAndConcat([ctx.At[0], fqn, annoArgs]));
|
|
211
|
-
};
|
|
212
|
-
InterfacesPrettierVisitor.prototype.elementValuePairList = function (ctx) {
|
|
213
|
-
var elementValuePairs = this.mapVisit(ctx.elementValuePair);
|
|
214
|
-
var commas = ctx.Comma ? ctx.Comma.map(function (elt) { return prettier_builder_1.concat([elt, line]); }) : [];
|
|
215
|
-
return printer_utils_1.rejectAndJoinSeps(commas, elementValuePairs);
|
|
216
|
-
};
|
|
217
|
-
InterfacesPrettierVisitor.prototype.elementValuePair = function (ctx) {
|
|
218
|
-
var identifier = ctx.Identifier[0];
|
|
219
|
-
var elementValue = this.visit(ctx.elementValue);
|
|
220
|
-
return printer_utils_1.rejectAndJoin(" ", [identifier, ctx.Equals[0], elementValue]);
|
|
221
|
-
};
|
|
222
|
-
InterfacesPrettierVisitor.prototype.elementValue = function (ctx) {
|
|
223
|
-
return this.visitSingle(ctx);
|
|
224
|
-
};
|
|
225
|
-
InterfacesPrettierVisitor.prototype.elementValueArrayInitializer = function (ctx) {
|
|
226
|
-
var elementValueList = this.visit(ctx.elementValueList);
|
|
227
|
-
return printer_utils_1.printArrayList({
|
|
228
|
-
list: elementValueList,
|
|
229
|
-
extraComma: ctx.Comma,
|
|
230
|
-
LCurly: ctx.LCurly[0],
|
|
231
|
-
RCurly: ctx.RCurly[0],
|
|
232
|
-
trailingComma: this.prettierOptions.trailingComma
|
|
233
|
-
});
|
|
234
|
-
};
|
|
235
|
-
InterfacesPrettierVisitor.prototype.elementValueList = function (ctx) {
|
|
236
|
-
var elementValues = this.mapVisit(ctx.elementValue);
|
|
237
|
-
var commas = ctx.Comma ? ctx.Comma.map(function (elt) { return prettier_builder_1.concat([elt, line]); }) : [];
|
|
238
|
-
return prettier_builder_1.group(printer_utils_1.rejectAndConcat([printer_utils_1.rejectAndJoinSeps(commas, elementValues)]));
|
|
239
|
-
};
|
|
240
|
-
InterfacesPrettierVisitor.prototype.identifyInterfaceBodyDeclarationType = function () {
|
|
241
|
-
return "identifyInterfaceBodyDeclarationType";
|
|
242
|
-
};
|
|
243
|
-
InterfacesPrettierVisitor.prototype.identifyAnnotationBodyDeclarationType = function () {
|
|
244
|
-
return "identifyAnnotationBodyDeclarationType";
|
|
245
|
-
};
|
|
246
|
-
InterfacesPrettierVisitor.prototype.isSimpleElementValueAnnotation = function () {
|
|
247
|
-
return "isSimpleElementValueAnnotation";
|
|
248
|
-
};
|
|
249
|
-
return InterfacesPrettierVisitor;
|
|
250
|
-
}(base_cst_printer_1.BaseCstPrettierPrinter));
|
|
251
|
-
exports.InterfacesPrettierVisitor = InterfacesPrettierVisitor;
|
|
@@ -1,43 +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.LexicalStructurePrettierVisitor = void 0;
|
|
19
|
-
var format_comments_1 = require("./comments/format-comments");
|
|
20
|
-
var base_cst_printer_1 = require("../base-cst-printer");
|
|
21
|
-
var LexicalStructurePrettierVisitor = /** @class */ (function (_super) {
|
|
22
|
-
__extends(LexicalStructurePrettierVisitor, _super);
|
|
23
|
-
function LexicalStructurePrettierVisitor() {
|
|
24
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
25
|
-
}
|
|
26
|
-
LexicalStructurePrettierVisitor.prototype.literal = function (ctx) {
|
|
27
|
-
if (ctx.CharLiteral || ctx.TextBlock || ctx.StringLiteral || ctx.Null) {
|
|
28
|
-
return format_comments_1.printTokenWithComments(this.getSingle(ctx));
|
|
29
|
-
}
|
|
30
|
-
return this.visitSingle(ctx);
|
|
31
|
-
};
|
|
32
|
-
LexicalStructurePrettierVisitor.prototype.integerLiteral = function (ctx) {
|
|
33
|
-
return format_comments_1.printTokenWithComments(this.getSingle(ctx));
|
|
34
|
-
};
|
|
35
|
-
LexicalStructurePrettierVisitor.prototype.floatingPointLiteral = function (ctx) {
|
|
36
|
-
return format_comments_1.printTokenWithComments(this.getSingle(ctx));
|
|
37
|
-
};
|
|
38
|
-
LexicalStructurePrettierVisitor.prototype.booleanLiteral = function (ctx) {
|
|
39
|
-
return format_comments_1.printTokenWithComments(this.getSingle(ctx));
|
|
40
|
-
};
|
|
41
|
-
return LexicalStructurePrettierVisitor;
|
|
42
|
-
}(base_cst_printer_1.BaseCstPrettierPrinter));
|
|
43
|
-
exports.LexicalStructurePrettierVisitor = LexicalStructurePrettierVisitor;
|
|
@@ -1,53 +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.NamesPrettierVisitor = void 0;
|
|
19
|
-
var printer_utils_1 = require("./printer-utils");
|
|
20
|
-
var format_comments_1 = require("./comments/format-comments");
|
|
21
|
-
var base_cst_printer_1 = require("../base-cst-printer");
|
|
22
|
-
var NamesPrettierVisitor = /** @class */ (function (_super) {
|
|
23
|
-
__extends(NamesPrettierVisitor, _super);
|
|
24
|
-
function NamesPrettierVisitor() {
|
|
25
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
26
|
-
}
|
|
27
|
-
NamesPrettierVisitor.prototype.typeIdentifier = function (ctx) {
|
|
28
|
-
return format_comments_1.printTokenWithComments(ctx.Identifier[0]);
|
|
29
|
-
};
|
|
30
|
-
NamesPrettierVisitor.prototype.moduleName = function (ctx) {
|
|
31
|
-
return printer_utils_1.buildFqn(ctx.Identifier, ctx.Dot);
|
|
32
|
-
};
|
|
33
|
-
NamesPrettierVisitor.prototype.packageName = function (ctx) {
|
|
34
|
-
return printer_utils_1.buildFqn(ctx.Identifier, ctx.Dot);
|
|
35
|
-
};
|
|
36
|
-
NamesPrettierVisitor.prototype.typeName = function (ctx) {
|
|
37
|
-
return printer_utils_1.buildFqn(ctx.Identifier, ctx.Dot);
|
|
38
|
-
};
|
|
39
|
-
NamesPrettierVisitor.prototype.expressionName = function (ctx) {
|
|
40
|
-
return printer_utils_1.buildFqn(ctx.Identifier, ctx.Dot);
|
|
41
|
-
};
|
|
42
|
-
NamesPrettierVisitor.prototype.methodName = function (ctx) {
|
|
43
|
-
return format_comments_1.printTokenWithComments(ctx.Identifier[0]);
|
|
44
|
-
};
|
|
45
|
-
NamesPrettierVisitor.prototype.packageOrTypeName = function (ctx) {
|
|
46
|
-
return printer_utils_1.buildFqn(ctx.Identifier, ctx.Dot);
|
|
47
|
-
};
|
|
48
|
-
NamesPrettierVisitor.prototype.ambiguousName = function (ctx) {
|
|
49
|
-
return printer_utils_1.buildFqn(ctx.Identifier, ctx.Dot);
|
|
50
|
-
};
|
|
51
|
-
return NamesPrettierVisitor;
|
|
52
|
-
}(base_cst_printer_1.BaseCstPrettierPrinter));
|
|
53
|
-
exports.NamesPrettierVisitor = NamesPrettierVisitor;
|
|
@@ -1,185 +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.PackagesAndModulesPrettierVisitor = void 0;
|
|
19
|
-
var prettier_builder_1 = require("./prettier-builder");
|
|
20
|
-
var format_comments_1 = require("./comments/format-comments");
|
|
21
|
-
var printer_utils_1 = require("./printer-utils");
|
|
22
|
-
var doc_1 = require("prettier/doc");
|
|
23
|
-
var base_cst_printer_1 = require("../base-cst-printer");
|
|
24
|
-
var utils_1 = require("../types/utils");
|
|
25
|
-
var line = doc_1.builders.line, hardline = doc_1.builders.hardline, indent = doc_1.builders.indent, group = doc_1.builders.group;
|
|
26
|
-
var PackagesAndModulesPrettierVisitor = /** @class */ (function (_super) {
|
|
27
|
-
__extends(PackagesAndModulesPrettierVisitor, _super);
|
|
28
|
-
function PackagesAndModulesPrettierVisitor() {
|
|
29
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
30
|
-
}
|
|
31
|
-
PackagesAndModulesPrettierVisitor.prototype.compilationUnit = function (ctx) {
|
|
32
|
-
var compilationUnit = utils_1.isOrdinaryCompilationUnitCtx(ctx)
|
|
33
|
-
? ctx.ordinaryCompilationUnit
|
|
34
|
-
: ctx.modularCompilationUnit;
|
|
35
|
-
return prettier_builder_1.concat([this.visit(compilationUnit[0]), line]);
|
|
36
|
-
};
|
|
37
|
-
PackagesAndModulesPrettierVisitor.prototype.ordinaryCompilationUnit = function (ctx) {
|
|
38
|
-
var packageDecl = this.visit(ctx.packageDeclaration);
|
|
39
|
-
var sortedImportsDecl = printer_utils_1.sortImports(ctx.importDeclaration);
|
|
40
|
-
var nonStaticImports = this.mapVisit(sortedImportsDecl.nonStaticImports);
|
|
41
|
-
var staticImports = this.mapVisit(sortedImportsDecl.staticImports);
|
|
42
|
-
var typesDecl = this.mapVisit(ctx.typeDeclaration);
|
|
43
|
-
// TODO: utility to add item+line (or multiple lines) but only if an item exists
|
|
44
|
-
return printer_utils_1.rejectAndConcat([
|
|
45
|
-
printer_utils_1.rejectAndJoin(prettier_builder_1.concat([hardline, hardline]), [
|
|
46
|
-
packageDecl,
|
|
47
|
-
printer_utils_1.rejectAndJoin(hardline, staticImports),
|
|
48
|
-
printer_utils_1.rejectAndJoin(hardline, nonStaticImports),
|
|
49
|
-
printer_utils_1.rejectAndJoin(prettier_builder_1.concat([hardline, hardline]), typesDecl)
|
|
50
|
-
])
|
|
51
|
-
]);
|
|
52
|
-
};
|
|
53
|
-
PackagesAndModulesPrettierVisitor.prototype.modularCompilationUnit = function (ctx) {
|
|
54
|
-
var sortedImportsDecl = printer_utils_1.sortImports(ctx.importDeclaration);
|
|
55
|
-
var nonStaticImports = this.mapVisit(sortedImportsDecl.nonStaticImports);
|
|
56
|
-
var staticImports = this.mapVisit(sortedImportsDecl.staticImports);
|
|
57
|
-
var moduleDeclaration = this.visit(ctx.moduleDeclaration);
|
|
58
|
-
return printer_utils_1.rejectAndConcat([
|
|
59
|
-
printer_utils_1.rejectAndJoin(prettier_builder_1.concat([hardline, hardline]), [
|
|
60
|
-
printer_utils_1.rejectAndJoin(hardline, staticImports),
|
|
61
|
-
printer_utils_1.rejectAndJoin(hardline, nonStaticImports),
|
|
62
|
-
moduleDeclaration
|
|
63
|
-
])
|
|
64
|
-
]);
|
|
65
|
-
};
|
|
66
|
-
PackagesAndModulesPrettierVisitor.prototype.packageDeclaration = function (ctx) {
|
|
67
|
-
var modifiers = this.mapVisit(ctx.packageModifier);
|
|
68
|
-
var name = printer_utils_1.buildFqn(ctx.Identifier, ctx.Dot);
|
|
69
|
-
return printer_utils_1.rejectAndJoin(hardline, [
|
|
70
|
-
printer_utils_1.rejectAndJoin(hardline, modifiers),
|
|
71
|
-
prettier_builder_1.concat([ctx.Package[0], " ", name, ctx.Semicolon[0]])
|
|
72
|
-
]);
|
|
73
|
-
};
|
|
74
|
-
PackagesAndModulesPrettierVisitor.prototype.packageModifier = function (ctx) {
|
|
75
|
-
return this.visitSingle(ctx);
|
|
76
|
-
};
|
|
77
|
-
PackagesAndModulesPrettierVisitor.prototype.importDeclaration = function (ctx) {
|
|
78
|
-
if (ctx.emptyStatement !== undefined) {
|
|
79
|
-
return this.visit(ctx.emptyStatement);
|
|
80
|
-
}
|
|
81
|
-
var optionalStatic = ctx.Static ? ctx.Static[0] : "";
|
|
82
|
-
var packageOrTypeName = this.visit(ctx.packageOrTypeName);
|
|
83
|
-
var optionalDotStar = ctx.Dot ? prettier_builder_1.concat([ctx.Dot[0], ctx.Star[0]]) : "";
|
|
84
|
-
return printer_utils_1.rejectAndJoin(" ", [
|
|
85
|
-
ctx.Import[0],
|
|
86
|
-
optionalStatic,
|
|
87
|
-
printer_utils_1.rejectAndConcat([packageOrTypeName, optionalDotStar, ctx.Semicolon[0]])
|
|
88
|
-
]);
|
|
89
|
-
};
|
|
90
|
-
PackagesAndModulesPrettierVisitor.prototype.typeDeclaration = function (ctx) {
|
|
91
|
-
if (ctx.Semicolon) {
|
|
92
|
-
return printer_utils_1.displaySemicolon(ctx.Semicolon[0]);
|
|
93
|
-
}
|
|
94
|
-
return this.visitSingle(ctx);
|
|
95
|
-
};
|
|
96
|
-
PackagesAndModulesPrettierVisitor.prototype.moduleDeclaration = function (ctx) {
|
|
97
|
-
var annotations = this.mapVisit(ctx.annotation);
|
|
98
|
-
var optionalOpen = ctx.Open ? ctx.Open[0] : "";
|
|
99
|
-
var name = printer_utils_1.buildFqn(ctx.Identifier, ctx.Dot);
|
|
100
|
-
var moduleDirectives = this.mapVisit(ctx.moduleDirective);
|
|
101
|
-
var content = printer_utils_1.rejectAndJoinSeps(printer_utils_1.getBlankLinesSeparator(ctx.moduleDirective), moduleDirectives);
|
|
102
|
-
return printer_utils_1.rejectAndJoin(" ", [
|
|
103
|
-
prettier_builder_1.join(" ", annotations),
|
|
104
|
-
optionalOpen,
|
|
105
|
-
ctx.Module[0],
|
|
106
|
-
name,
|
|
107
|
-
printer_utils_1.putIntoBraces(content, hardline, ctx.LCurly[0], ctx.RCurly[0])
|
|
108
|
-
]);
|
|
109
|
-
};
|
|
110
|
-
PackagesAndModulesPrettierVisitor.prototype.moduleDirective = function (ctx) {
|
|
111
|
-
return this.visitSingle(ctx);
|
|
112
|
-
};
|
|
113
|
-
PackagesAndModulesPrettierVisitor.prototype.requiresModuleDirective = function (ctx) {
|
|
114
|
-
var modifiers = this.mapVisit(ctx.requiresModifier);
|
|
115
|
-
var moduleName = this.visit(ctx.moduleName);
|
|
116
|
-
return printer_utils_1.rejectAndJoin(" ", [
|
|
117
|
-
ctx.Requires[0],
|
|
118
|
-
prettier_builder_1.join(" ", modifiers),
|
|
119
|
-
prettier_builder_1.concat([moduleName, ctx.Semicolon[0]])
|
|
120
|
-
]);
|
|
121
|
-
};
|
|
122
|
-
PackagesAndModulesPrettierVisitor.prototype.exportsModuleDirective = function (ctx) {
|
|
123
|
-
var packageName = this.visit(ctx.packageName);
|
|
124
|
-
var to = ctx.To ? ctx.To[0] : "";
|
|
125
|
-
var moduleNames = this.mapVisit(ctx.moduleName);
|
|
126
|
-
var commas = ctx.Comma ? ctx.Comma.map(function (elt) { return prettier_builder_1.concat([elt, line]); }) : [];
|
|
127
|
-
return group(printer_utils_1.rejectAndConcat([
|
|
128
|
-
indent(printer_utils_1.rejectAndJoin(line, [
|
|
129
|
-
printer_utils_1.rejectAndJoin(" ", [ctx.Exports[0], packageName]),
|
|
130
|
-
group(indent(printer_utils_1.rejectAndJoin(line, [
|
|
131
|
-
to,
|
|
132
|
-
printer_utils_1.rejectAndJoinSeps(commas, moduleNames)
|
|
133
|
-
])))
|
|
134
|
-
])),
|
|
135
|
-
ctx.Semicolon[0]
|
|
136
|
-
]));
|
|
137
|
-
};
|
|
138
|
-
PackagesAndModulesPrettierVisitor.prototype.opensModuleDirective = function (ctx) {
|
|
139
|
-
var packageName = this.visit(ctx.packageName);
|
|
140
|
-
var to = ctx.To ? ctx.To[0] : "";
|
|
141
|
-
var moduleNames = this.mapVisit(ctx.moduleName);
|
|
142
|
-
var commas = ctx.Comma ? ctx.Comma.map(function (elt) { return prettier_builder_1.concat([elt, line]); }) : [];
|
|
143
|
-
return group(printer_utils_1.rejectAndConcat([
|
|
144
|
-
indent(printer_utils_1.rejectAndJoin(line, [
|
|
145
|
-
printer_utils_1.rejectAndJoin(" ", [ctx.Opens[0], packageName]),
|
|
146
|
-
group(indent(printer_utils_1.rejectAndJoin(line, [
|
|
147
|
-
to,
|
|
148
|
-
printer_utils_1.rejectAndJoinSeps(commas, moduleNames)
|
|
149
|
-
])))
|
|
150
|
-
])),
|
|
151
|
-
ctx.Semicolon[0]
|
|
152
|
-
]));
|
|
153
|
-
};
|
|
154
|
-
PackagesAndModulesPrettierVisitor.prototype.usesModuleDirective = function (ctx) {
|
|
155
|
-
var typeName = this.visit(ctx.typeName);
|
|
156
|
-
return printer_utils_1.rejectAndConcat([
|
|
157
|
-
prettier_builder_1.concat([ctx.Uses[0], " "]),
|
|
158
|
-
typeName,
|
|
159
|
-
ctx.Semicolon[0]
|
|
160
|
-
]);
|
|
161
|
-
};
|
|
162
|
-
PackagesAndModulesPrettierVisitor.prototype.providesModuleDirective = function (ctx) {
|
|
163
|
-
var firstTypeName = this.visit(ctx.typeName[0]);
|
|
164
|
-
var otherTypeNames = this.mapVisit(ctx.typeName.slice(1));
|
|
165
|
-
var commas = ctx.Comma ? ctx.Comma.map(function (elt) { return prettier_builder_1.concat([elt, line]); }) : [];
|
|
166
|
-
return group(printer_utils_1.rejectAndConcat([
|
|
167
|
-
indent(printer_utils_1.rejectAndJoin(line, [
|
|
168
|
-
printer_utils_1.rejectAndJoin(" ", [ctx.Provides[0], firstTypeName]),
|
|
169
|
-
group(indent(printer_utils_1.rejectAndJoin(line, [
|
|
170
|
-
ctx.With[0],
|
|
171
|
-
printer_utils_1.rejectAndJoinSeps(commas, otherTypeNames)
|
|
172
|
-
])))
|
|
173
|
-
])),
|
|
174
|
-
ctx.Semicolon[0]
|
|
175
|
-
]));
|
|
176
|
-
};
|
|
177
|
-
PackagesAndModulesPrettierVisitor.prototype.requiresModifier = function (ctx) {
|
|
178
|
-
return format_comments_1.printTokenWithComments(this.getSingle(ctx));
|
|
179
|
-
};
|
|
180
|
-
PackagesAndModulesPrettierVisitor.prototype.isModuleCompilationUnit = function () {
|
|
181
|
-
return "isModuleCompilationUnit";
|
|
182
|
-
};
|
|
183
|
-
return PackagesAndModulesPrettierVisitor;
|
|
184
|
-
}(base_cst_printer_1.BaseCstPrettierPrinter));
|
|
185
|
-
exports.PackagesAndModulesPrettierVisitor = PackagesAndModulesPrettierVisitor;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ifBreak = exports.dedent = exports.indent = exports.fill = exports.group = exports.join = exports.concat = void 0;
|
|
4
|
-
var prettier = require("prettier").doc.builders;
|
|
5
|
-
var processComments = require("./comments/format-comments").processComments;
|
|
6
|
-
/*
|
|
7
|
-
* ------------------------------------------------------------------
|
|
8
|
-
* Wraps the Prettier builder functions to print tokens with comments
|
|
9
|
-
* ------------------------------------------------------------------
|
|
10
|
-
*/
|
|
11
|
-
function concat(docs) {
|
|
12
|
-
var concatenation = processComments(docs);
|
|
13
|
-
if (!Array.isArray(docs)) {
|
|
14
|
-
return "";
|
|
15
|
-
}
|
|
16
|
-
return concatenation;
|
|
17
|
-
}
|
|
18
|
-
exports.concat = concat;
|
|
19
|
-
function join(sep, docs) {
|
|
20
|
-
var concatenation = prettier.join(processComments(sep), processComments(docs));
|
|
21
|
-
return concatenation.length === 0 ? "" : concatenation;
|
|
22
|
-
}
|
|
23
|
-
exports.join = join;
|
|
24
|
-
function group(doc, opts) {
|
|
25
|
-
var group = prettier.group(processComments(doc), opts);
|
|
26
|
-
return group.contents === undefined ? "" : group;
|
|
27
|
-
}
|
|
28
|
-
exports.group = group;
|
|
29
|
-
function fill(docs) {
|
|
30
|
-
var fill = prettier.fill(processComments(docs));
|
|
31
|
-
return fill.length === 0 ? "" : fill;
|
|
32
|
-
}
|
|
33
|
-
exports.fill = fill;
|
|
34
|
-
function indent(doc) {
|
|
35
|
-
var indentedDoc = prettier.indent(processComments(doc));
|
|
36
|
-
return indentedDoc.contents.length === 0 ? "" : indentedDoc;
|
|
37
|
-
}
|
|
38
|
-
exports.indent = indent;
|
|
39
|
-
function dedent(doc) {
|
|
40
|
-
var indentedDoc = prettier.dedent(processComments(doc));
|
|
41
|
-
return indentedDoc.contents.length === 0 ? "" : indentedDoc;
|
|
42
|
-
}
|
|
43
|
-
exports.dedent = dedent;
|
|
44
|
-
function ifBreak(breakContents, flatContents) {
|
|
45
|
-
return prettier.ifBreak(processComments(breakContents), processComments(flatContents));
|
|
46
|
-
}
|
|
47
|
-
exports.ifBreak = ifBreak;
|