prettier-plugin-bq 1.0.0-beta.2 → 1.0.0-beta.4

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/printer.js CHANGED
@@ -1,7 +1,10 @@
1
- import { reservedKeywords, globalFunctions, keysFunctions, aeadFunctions, hllCountFunctions, kllQuantilesFunctions, netFunctions, objFunctions, mlFunctions, aiFunctions, vectorIndexFunctions, } from "./keywords.js";
2
- import { doc } from "prettier";
3
- const { builders: { breakParent, group, hardline, ifBreak, indent, join, line, lineSuffix, softline, }, } = doc;
4
- export const isNodeChild = (child) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.printSQL = exports.isNodeVecChild = exports.isNodeChild = void 0;
4
+ const keywords_1 = require("./keywords");
5
+ const prettier_1 = require("prettier");
6
+ const { builders: { breakParent, group, hardline, ifBreak, indent, join, line, lineSuffix, softline, }, } = prettier_1.doc;
7
+ const isNodeChild = (child) => {
5
8
  if (child &&
6
9
  typeof child === "object" &&
7
10
  Object.keys(child).length === 1 &&
@@ -10,7 +13,8 @@ export const isNodeChild = (child) => {
10
13
  }
11
14
  return false;
12
15
  };
13
- export const isNodeVecChild = (child) => {
16
+ exports.isNodeChild = isNodeChild;
17
+ const isNodeVecChild = (child) => {
14
18
  if (child &&
15
19
  typeof child === "object" &&
16
20
  Object.keys(child).length === 1 &&
@@ -19,6 +23,7 @@ export const isNodeVecChild = (child) => {
19
23
  }
20
24
  return false;
21
25
  };
26
+ exports.isNodeVecChild = isNodeVecChild;
22
27
  class Printer {
23
28
  constructor(path, options, print, node) {
24
29
  this.path = path;
@@ -30,7 +35,7 @@ class Printer {
30
35
  child(key, transform, consumeLeadingComments, sep) {
31
36
  const child = this.children[key];
32
37
  let f = (x) => x;
33
- if (isNodeChild(child)) {
38
+ if ((0, exports.isNodeChild)(child)) {
34
39
  if (typeof transform === "function") {
35
40
  f = transform;
36
41
  }
@@ -43,7 +48,7 @@ class Printer {
43
48
  this.path.call((p) => p.call((p) => f(p.call(this.print, "Node")), key), "children"),
44
49
  ];
45
50
  }
46
- else if (isNodeVecChild(child)) {
51
+ else if ((0, exports.isNodeVecChild)(child)) {
47
52
  if (typeof transform === "function") {
48
53
  f = transform;
49
54
  }
@@ -62,7 +67,7 @@ class Printer {
62
67
  consumeAllCommentsOfX(key) {
63
68
  let res = "";
64
69
  const child = this.children[key];
65
- if (isNodeChild(child)) {
70
+ if ((0, exports.isNodeChild)(child)) {
66
71
  const leading_comments = child.Node.children.leading_comments;
67
72
  if (leading_comments) {
68
73
  res = leading_comments.NodeVec.map((x) => lineSuffix([" ", x.token.literal]));
@@ -107,10 +112,10 @@ class Printer {
107
112
  else if (target === "all") {
108
113
  const child = this.children[key];
109
114
  let firstNodes = [];
110
- if (isNodeChild(child)) {
115
+ if ((0, exports.isNodeChild)(child)) {
111
116
  firstNodes = [getFirstNode(child.Node)];
112
117
  }
113
- else if (isNodeVecChild(child)) {
118
+ else if ((0, exports.isNodeVecChild)(child)) {
114
119
  firstNodes = child.NodeVec.map((x) => getFirstNode(x));
115
120
  }
116
121
  const res = [];
@@ -137,10 +142,10 @@ class Printer {
137
142
  getFirstNode(key) {
138
143
  const child = this.children[key];
139
144
  let firstNode;
140
- if (isNodeChild(child)) {
145
+ if ((0, exports.isNodeChild)(child)) {
141
146
  firstNode = getFirstNode(child.Node);
142
147
  }
143
- else if (isNodeVecChild(child) && child.NodeVec.length > 0) {
148
+ else if ((0, exports.isNodeVecChild)(child) && child.NodeVec.length > 0) {
144
149
  firstNode = getFirstNode(child.NodeVec[0]);
145
150
  }
146
151
  else {
@@ -173,7 +178,7 @@ class Printer {
173
178
  }
174
179
  len(key) {
175
180
  const nodeVec = this.children[key];
176
- if (isNodeVecChild(nodeVec)) {
181
+ if ((0, exports.isNodeVecChild)(nodeVec)) {
177
182
  return nodeVec.NodeVec.length;
178
183
  }
179
184
  return 0;
@@ -199,7 +204,7 @@ class Printer {
199
204
  if (upperOrLower === "upper") {
200
205
  literal = literal.toUpperCase();
201
206
  }
202
- else if (!this.node.notGlobal && this.includedIn(reservedKeywords)) {
207
+ else if (!this.node.notGlobal && this.includedIn(keywords_1.reservedKeywords)) {
203
208
  literal = literal.toUpperCase();
204
209
  }
205
210
  else if (this.options.printKeywordsInUpperCase &&
@@ -226,7 +231,7 @@ class Printer {
226
231
  }
227
232
  setBreakRecommended(key) {
228
233
  const child = this.children[key];
229
- if (isNodeChild(child)) {
234
+ if ((0, exports.isNodeChild)(child)) {
230
235
  child.Node.breakRecommended = true;
231
236
  }
232
237
  }
@@ -237,10 +242,10 @@ class Printer {
237
242
  * e.g. when grouping a part of `this.child(key)`.
238
243
  */
239
244
  const child = this.children[key];
240
- if (isNodeChild(child)) {
245
+ if ((0, exports.isNodeChild)(child)) {
241
246
  child.Node.groupRecommended = true;
242
247
  }
243
- else if (isNodeVecChild(child)) {
248
+ else if ((0, exports.isNodeVecChild)(child)) {
244
249
  child.NodeVec.forEach((x) => {
245
250
  x.groupRecommended = true;
246
251
  });
@@ -248,7 +253,7 @@ class Printer {
248
253
  }
249
254
  setLiteral(key, literal) {
250
255
  const child = this.children[key];
251
- if (isNodeChild(child)) {
256
+ if ((0, exports.isNodeChild)(child)) {
252
257
  const token = child.Node.token;
253
258
  if (token) {
254
259
  token.literal = literal;
@@ -257,10 +262,10 @@ class Printer {
257
262
  }
258
263
  setNotRoot(key) {
259
264
  const child = this.children[key];
260
- if (isNodeChild(child)) {
265
+ if ((0, exports.isNodeChild)(child)) {
261
266
  child.Node.notRoot = true;
262
267
  }
263
- else if (isNodeVecChild(child)) {
268
+ else if ((0, exports.isNodeVecChild)(child)) {
264
269
  child.NodeVec.forEach((x) => {
265
270
  x.notRoot = true;
266
271
  });
@@ -268,7 +273,7 @@ class Printer {
268
273
  }
269
274
  setNotGlobal(key) {
270
275
  const child = this.children[key];
271
- if (isNodeChild(child)) {
276
+ if ((0, exports.isNodeChild)(child)) {
272
277
  child.Node.notGlobal = true;
273
278
  }
274
279
  }
@@ -276,7 +281,7 @@ class Printer {
276
281
  if (this.hasLeadingComments(key))
277
282
  return true;
278
283
  const child = this.children[key];
279
- if (!isNodeChild(child))
284
+ if (!(0, exports.isNodeChild)(child))
280
285
  return false; // unnexpected pattern
281
286
  const token = child.Node.token;
282
287
  if (!token)
@@ -303,13 +308,13 @@ class Printer {
303
308
  if (!this.options.printKeywordsInUpperCase) {
304
309
  return;
305
310
  }
306
- if (isNodeChild(child)) {
311
+ if ((0, exports.isNodeChild)(child)) {
307
312
  const token = child.Node.token;
308
313
  if (token) {
309
314
  token.literal = token.literal.toUpperCase();
310
315
  }
311
316
  }
312
- else if (isNodeVecChild(child)) {
317
+ else if ((0, exports.isNodeVecChild)(child)) {
313
318
  child.NodeVec.forEach((x) => {
314
319
  const token = x.token;
315
320
  if (token) {
@@ -326,10 +331,10 @@ const getFirstNode = (node, includeComment = false) => {
326
331
  !includeComment) {
327
332
  continue;
328
333
  }
329
- if (isNodeChild(v)) {
334
+ if ((0, exports.isNodeChild)(v)) {
330
335
  candidates.push(getFirstNode(v.Node, includeComment));
331
336
  }
332
- else if (isNodeVecChild(v)) {
337
+ else if ((0, exports.isNodeVecChild)(v)) {
333
338
  // NOTE maybe you don't have to check 2nd, 3rd, or latter node
334
339
  v.NodeVec.forEach((x) => candidates.push(getFirstNode(x, includeComment)));
335
340
  }
@@ -357,10 +362,10 @@ const getLastNode = (node, includeComment = false) => {
357
362
  !includeComment) {
358
363
  continue;
359
364
  }
360
- if (isNodeChild(v)) {
365
+ if ((0, exports.isNodeChild)(v)) {
361
366
  candidates.push(getLastNode(v.Node, includeComment));
362
367
  }
363
- else if (isNodeVecChild(v)) {
368
+ else if ((0, exports.isNodeVecChild)(v)) {
364
369
  // NOTE maybe you don't have to check 2nd, 3rd, or latter node
365
370
  v.NodeVec.forEach((x) => candidates.push(getLastNode(x, includeComment)));
366
371
  }
@@ -381,7 +386,7 @@ const getLastNode = (node, includeComment = false) => {
381
386
  }
382
387
  return res;
383
388
  };
384
- export const printSQL = (path, options, print) => {
389
+ const printSQL = (path, options, print) => {
385
390
  const node = path.node;
386
391
  if (Array.isArray(node)) {
387
392
  for (let i = 0; i < node.length - 1; i++) {
@@ -718,6 +723,7 @@ export const printSQL = (path, options, print) => {
718
723
  throw new Error(`Not implemented node type: ${JSON.stringify(node)}`);
719
724
  }
720
725
  };
726
+ exports.printSQL = printSQL;
721
727
  const printAccessOperator = (path, options, print, node) => {
722
728
  const p = new Printer(path, options, print, node);
723
729
  const docs = {
@@ -1536,6 +1542,9 @@ const printCallingFunctionGeneral = (path, options, print, node) => {
1536
1542
  const p = new Printer(path, options, print, node);
1537
1543
  p.setNotRoot("args");
1538
1544
  let func = node.children.func.Node;
1545
+ if (func.node_type === "GroupedExpr" && node.isChained) {
1546
+ func = func.children.expr.Node;
1547
+ }
1539
1548
  let parent;
1540
1549
  let grandParent;
1541
1550
  if (node.isDatePart) {
@@ -1550,7 +1559,7 @@ const printCallingFunctionGeneral = (path, options, print, node) => {
1550
1559
  };
1551
1560
  if (func.node_type === "Identifier") {
1552
1561
  // SUBSTR("foo", 0, 2)
1553
- if (globalFunctions.includes(func.token.literal.toUpperCase())) {
1562
+ if (keywords_1.globalFunctions.includes(func.token.literal.toUpperCase())) {
1554
1563
  func.isPreDefinedFunction = true;
1555
1564
  }
1556
1565
  }
@@ -1562,61 +1571,61 @@ const printCallingFunctionGeneral = (path, options, print, node) => {
1562
1571
  // KEYS.NEW_KEYSET('AEAD_AES_GCM_256')
1563
1572
  switch (parent.token.literal.toUpperCase()) {
1564
1573
  case "SAFE":
1565
- if (globalFunctions.includes(func.token.literal.toUpperCase())) {
1574
+ if (keywords_1.globalFunctions.includes(func.token.literal.toUpperCase())) {
1566
1575
  func.isPreDefinedFunction = true;
1567
1576
  toUpper(parent.token);
1568
1577
  }
1569
1578
  break;
1570
1579
  case "KEYS":
1571
- if (keysFunctions.includes(func.token.literal.toUpperCase())) {
1580
+ if (keywords_1.keysFunctions.includes(func.token.literal.toUpperCase())) {
1572
1581
  func.isPreDefinedFunction = true;
1573
1582
  toUpper(parent.token);
1574
1583
  }
1575
1584
  break;
1576
1585
  case "AEAD":
1577
- if (aeadFunctions.includes(func.token.literal.toUpperCase())) {
1586
+ if (keywords_1.aeadFunctions.includes(func.token.literal.toUpperCase())) {
1578
1587
  func.isPreDefinedFunction = true;
1579
1588
  toUpper(parent.token);
1580
1589
  }
1581
1590
  break;
1582
1591
  case "NET":
1583
- if (netFunctions.includes(func.token.literal.toUpperCase())) {
1592
+ if (keywords_1.netFunctions.includes(func.token.literal.toUpperCase())) {
1584
1593
  func.isPreDefinedFunction = true;
1585
1594
  toUpper(parent.token);
1586
1595
  }
1587
1596
  break;
1588
1597
  case "HLL_COUNT":
1589
- if (hllCountFunctions.includes(func.token.literal.toUpperCase())) {
1598
+ if (keywords_1.hllCountFunctions.includes(func.token.literal.toUpperCase())) {
1590
1599
  func.isPreDefinedFunction = true;
1591
1600
  toUpper(parent.token);
1592
1601
  }
1593
1602
  break;
1594
1603
  case "KLL_QUANTILES":
1595
- if (kllQuantilesFunctions.includes(func.token.literal.toUpperCase())) {
1604
+ if (keywords_1.kllQuantilesFunctions.includes(func.token.literal.toUpperCase())) {
1596
1605
  func.isPreDefinedFunction = true;
1597
1606
  toUpper(parent.token);
1598
1607
  }
1599
1608
  break;
1600
1609
  case "OBJ":
1601
- if (objFunctions.includes(func.token.literal.toUpperCase())) {
1610
+ if (keywords_1.objFunctions.includes(func.token.literal.toUpperCase())) {
1602
1611
  func.isPreDefinedFunction = true;
1603
1612
  toUpper(parent.token);
1604
1613
  }
1605
1614
  break;
1606
1615
  case "ML":
1607
- if (mlFunctions.includes(func.token.literal.toUpperCase())) {
1616
+ if (keywords_1.mlFunctions.includes(func.token.literal.toUpperCase())) {
1608
1617
  func.isPreDefinedFunction = true;
1609
1618
  toUpper(parent.token);
1610
1619
  }
1611
1620
  break;
1612
1621
  case "AI":
1613
- if (aiFunctions.includes(func.token.literal.toUpperCase())) {
1622
+ if (keywords_1.aiFunctions.includes(func.token.literal.toUpperCase())) {
1614
1623
  func.isPreDefinedFunction = true;
1615
1624
  toUpper(parent.token);
1616
1625
  }
1617
1626
  break;
1618
1627
  case "VECTOR_INDEX":
1619
- if (vectorIndexFunctions.includes(func.token.literal.toUpperCase())) {
1628
+ if (keywords_1.vectorIndexFunctions.includes(func.token.literal.toUpperCase())) {
1620
1629
  func.isPreDefinedFunction = true;
1621
1630
  toUpper(parent.token);
1622
1631
  }
@@ -1630,63 +1639,63 @@ const printCallingFunctionGeneral = (path, options, print, node) => {
1630
1639
  if (grandParent.token.literal.toUpperCase() === "SAFE") {
1631
1640
  switch (parent.token.literal.toUpperCase()) {
1632
1641
  case "KEYS":
1633
- if (keysFunctions.includes(func.token.literal.toUpperCase())) {
1642
+ if (keywords_1.keysFunctions.includes(func.token.literal.toUpperCase())) {
1634
1643
  func.isPreDefinedFunction = true;
1635
1644
  toUpper(parent.token);
1636
1645
  toUpper(grandParent.token);
1637
1646
  }
1638
1647
  break;
1639
1648
  case "AEAD":
1640
- if (aeadFunctions.includes(func.token.literal.toUpperCase())) {
1649
+ if (keywords_1.aeadFunctions.includes(func.token.literal.toUpperCase())) {
1641
1650
  func.isPreDefinedFunction = true;
1642
1651
  toUpper(parent.token);
1643
1652
  toUpper(grandParent.token);
1644
1653
  }
1645
1654
  break;
1646
1655
  case "NET":
1647
- if (netFunctions.includes(func.token.literal.toUpperCase())) {
1656
+ if (keywords_1.netFunctions.includes(func.token.literal.toUpperCase())) {
1648
1657
  func.isPreDefinedFunction = true;
1649
1658
  toUpper(parent.token);
1650
1659
  toUpper(grandParent.token);
1651
1660
  }
1652
1661
  break;
1653
1662
  case "HLL_COUNT":
1654
- if (hllCountFunctions.includes(func.token.literal.toUpperCase())) {
1663
+ if (keywords_1.hllCountFunctions.includes(func.token.literal.toUpperCase())) {
1655
1664
  func.isPreDefinedFunction = true;
1656
1665
  toUpper(parent.token);
1657
1666
  toUpper(grandParent.token);
1658
1667
  }
1659
1668
  break;
1660
1669
  case "KLL_QUANTILES":
1661
- if (kllQuantilesFunctions.includes(func.token.literal.toUpperCase())) {
1670
+ if (keywords_1.kllQuantilesFunctions.includes(func.token.literal.toUpperCase())) {
1662
1671
  func.isPreDefinedFunction = true;
1663
1672
  toUpper(parent.token);
1664
1673
  toUpper(grandParent.token);
1665
1674
  }
1666
1675
  break;
1667
1676
  case "OBJ":
1668
- if (objFunctions.includes(func.token.literal.toUpperCase())) {
1677
+ if (keywords_1.objFunctions.includes(func.token.literal.toUpperCase())) {
1669
1678
  func.isPreDefinedFunction = true;
1670
1679
  toUpper(parent.token);
1671
1680
  toUpper(grandParent.token);
1672
1681
  }
1673
1682
  break;
1674
1683
  case "ML":
1675
- if (mlFunctions.includes(func.token.literal.toUpperCase())) {
1684
+ if (keywords_1.mlFunctions.includes(func.token.literal.toUpperCase())) {
1676
1685
  func.isPreDefinedFunction = true;
1677
1686
  toUpper(parent.token);
1678
1687
  toUpper(grandParent.token);
1679
1688
  }
1680
1689
  break;
1681
1690
  case "AI":
1682
- if (aiFunctions.includes(func.token.literal.toUpperCase())) {
1691
+ if (keywords_1.aiFunctions.includes(func.token.literal.toUpperCase())) {
1683
1692
  func.isPreDefinedFunction = true;
1684
1693
  toUpper(parent.token);
1685
1694
  toUpper(grandParent.token);
1686
1695
  }
1687
1696
  break;
1688
1697
  case "VECTOR_INDEX":
1689
- if (vectorIndexFunctions.includes(func.token.literal.toUpperCase())) {
1698
+ if (keywords_1.vectorIndexFunctions.includes(func.token.literal.toUpperCase())) {
1690
1699
  func.isPreDefinedFunction = true;
1691
1700
  toUpper(parent.token);
1692
1701
  toUpper(grandParent.token);
@@ -2091,7 +2100,7 @@ const printCreateFunctionStatement = (path, options, print, node) => {
2091
2100
  leading_comments: printLeadingComments(path, options, print, node),
2092
2101
  self: p.self("upper"),
2093
2102
  trailing_comments: printTrailingComments(path, options, print, node),
2094
- or_replace: p.child("or_replace", (x) => group([line, x])),
2103
+ or_replace: p.child("or_replace", (x) => [" ", x], "all"),
2095
2104
  temp: p.child("temp", undefined, "all"),
2096
2105
  table: p.child("table", undefined, "all"),
2097
2106
  aggregate: p.child("aggregate", undefined, "all"),
@@ -2153,7 +2162,7 @@ const printCreateModelStatement = (path, options, print, node) => {
2153
2162
  leading_comments: printLeadingComments(path, options, print, node),
2154
2163
  self: p.self("upper"),
2155
2164
  trailing_comments: printTrailingComments(path, options, print, node),
2156
- or_replace: p.child("or_replace", (x) => group([line, x])),
2165
+ or_replace: p.child("or_replace", (x) => [" ", x], "all"),
2157
2166
  what: p.child("what", undefined, "all"),
2158
2167
  if_not_exists: p.child("if_not_exists", (x) => group([line, x])),
2159
2168
  ident: p.child("ident", undefined, "all"),
@@ -2204,7 +2213,7 @@ const printCreateProcedureStatement = (path, options, print, node) => {
2204
2213
  leading_comments: printLeadingComments(path, options, print, node),
2205
2214
  self: p.self("upper"),
2206
2215
  trailing_comments: printTrailingComments(path, options, print, node),
2207
- or_replace: p.child("or_replace", (x) => group([line, x])),
2216
+ or_replace: p.child("or_replace", (x) => [" ", x], "all"),
2208
2217
  what: p.child("what", undefined, "all"),
2209
2218
  if_not_exists: p.child("if_not_exists", (x) => group([line, x])),
2210
2219
  ident: p.child("ident", undefined, "all"),
@@ -2291,7 +2300,7 @@ const printCreateRowAccessPolicyStatement = (path, options, print, node) => {
2291
2300
  leading_comments: printLeadingComments(path, options, print, node),
2292
2301
  self: p.self("upper"),
2293
2302
  trailing_comments: printTrailingComments(path, options, print, node),
2294
- or_replace: p.child("or_replace", (x) => group([line, x])),
2303
+ or_replace: p.child("or_replace", (x) => [" ", x], "all"),
2295
2304
  what: p.child("what", undefined, "all", " "),
2296
2305
  if_not_exists: p.child("if_not_exists", (x) => group([line, x])),
2297
2306
  ident: p.child("ident", undefined, "all"),
@@ -2374,7 +2383,7 @@ const printCreateIndexStatement = (path, options, print, node) => {
2374
2383
  leading_comments: printLeadingComments(path, options, print, node),
2375
2384
  self: p.self("upper"),
2376
2385
  trailing_comments: printTrailingComments(path, options, print, node),
2377
- or_replace: p.child("or_replace", (x) => group([line, x])),
2386
+ or_replace: p.child("or_replace", (x) => [" ", x], "all"),
2378
2387
  what: p.child("what", undefined, "all"),
2379
2388
  if_not_exists: p.child("if_not_exists", (x) => group([line, x])),
2380
2389
  ident: p.child("ident", undefined, "all"),
@@ -2422,7 +2431,7 @@ const printCreateTableStatement = (path, options, print, node) => {
2422
2431
  leading_comments: printLeadingComments(path, options, print, node),
2423
2432
  self: p.self("upper"),
2424
2433
  trailing_comments: printTrailingComments(path, options, print, node),
2425
- or_replace: p.child("or_replace", (x) => group([line, x])),
2434
+ or_replace: p.child("or_replace", (x) => [" ", x], "all"),
2426
2435
  temp: p.child("temp", undefined, "all"),
2427
2436
  external: p.child("external", undefined, "all"),
2428
2437
  snapshot: p.child("snapshot", undefined, "all"),
@@ -2493,7 +2502,7 @@ const printCreateViewStatement = (path, options, print, node) => {
2493
2502
  leading_comments: printLeadingComments(path, options, print, node),
2494
2503
  self: p.self("upper"),
2495
2504
  trailing_comments: printTrailingComments(path, options, print, node),
2496
- or_replace: p.child("or_replace", (x) => group([line, x])),
2505
+ or_replace: p.child("or_replace", (x) => [" ", x], "all"),
2497
2506
  materialized: p.child("materialized", undefined, "all"),
2498
2507
  what: p.child("what", undefined, "all"),
2499
2508
  if_not_exists: p.child("if_not_exists", (x) => group([line, x])),
@@ -3349,7 +3358,7 @@ const printIfStatement = (path, options, print, node) => {
3349
3358
  docs.self,
3350
3359
  docs.trailing_comments,
3351
3360
  " ",
3352
- docs.condition,
3361
+ group(docs.condition),
3353
3362
  " ",
3354
3363
  docs.then,
3355
3364
  docs.elseifs,
@@ -4361,16 +4370,18 @@ const printSelectPipeOperator = (path, options, print, node) => {
4361
4370
  self: p.self(),
4362
4371
  trailing_comments: printTrailingComments(path, options, print, node),
4363
4372
  keywords: p.child("keywords", undefined, "all"),
4364
- exprs: p.child("exprs", (x) => group([line, x])),
4373
+ exprs: p.child("exprs", (x) => [line, x]),
4365
4374
  window: p.child("window"),
4366
4375
  };
4367
4376
  return [
4368
4377
  docs.leading_comments,
4369
- docs.self,
4370
- docs.trailing_comments,
4371
- p.has("keywords") ? " " : "",
4372
- docs.keywords,
4373
- indent(docs.exprs),
4378
+ group([
4379
+ docs.self,
4380
+ docs.trailing_comments,
4381
+ p.has("keywords") ? " " : "",
4382
+ docs.keywords,
4383
+ indent(docs.exprs),
4384
+ ]),
4374
4385
  p.has("window") ? line : "",
4375
4386
  docs.window,
4376
4387
  ];