@haneullabs/prettier-plugin-move 0.3.3

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.
Files changed (149) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/CONTRIBUTING.md +31 -0
  3. package/README.md +96 -0
  4. package/bin/prettier-move.js +29 -0
  5. package/out/cst/annotation.js +64 -0
  6. package/out/cst/annotation.js.map +1 -0
  7. package/out/cst/common.js +376 -0
  8. package/out/cst/common.js.map +1 -0
  9. package/out/cst/constant.js +92 -0
  10. package/out/cst/constant.js.map +1 -0
  11. package/out/cst/enum_definition.js +69 -0
  12. package/out/cst/enum_definition.js.map +1 -0
  13. package/out/cst/expression/abort_expression.js +32 -0
  14. package/out/cst/expression/abort_expression.js.map +1 -0
  15. package/out/cst/expression/annotation_expression.js +35 -0
  16. package/out/cst/expression/annotation_expression.js.map +1 -0
  17. package/out/cst/expression/assign_expression.js +51 -0
  18. package/out/cst/expression/assign_expression.js.map +1 -0
  19. package/out/cst/expression/binary_expression.js +70 -0
  20. package/out/cst/expression/binary_expression.js.map +1 -0
  21. package/out/cst/expression/block.js +58 -0
  22. package/out/cst/expression/block.js.map +1 -0
  23. package/out/cst/expression/block_item.js +25 -0
  24. package/out/cst/expression/block_item.js.map +1 -0
  25. package/out/cst/expression/borrow_expression.js +26 -0
  26. package/out/cst/expression/borrow_expression.js.map +1 -0
  27. package/out/cst/expression/break_expression.js +27 -0
  28. package/out/cst/expression/break_expression.js.map +1 -0
  29. package/out/cst/expression/call_expression.js +25 -0
  30. package/out/cst/expression/call_expression.js.map +1 -0
  31. package/out/cst/expression/cast_expression.js +31 -0
  32. package/out/cst/expression/cast_expression.js.map +1 -0
  33. package/out/cst/expression/continue_expression.js +26 -0
  34. package/out/cst/expression/continue_expression.js.map +1 -0
  35. package/out/cst/expression/dereference_expression.js +27 -0
  36. package/out/cst/expression/dereference_expression.js.map +1 -0
  37. package/out/cst/expression/dot_expression.js +66 -0
  38. package/out/cst/expression/dot_expression.js.map +1 -0
  39. package/out/cst/expression/expression_list.js +26 -0
  40. package/out/cst/expression/expression_list.js.map +1 -0
  41. package/out/cst/expression/identified_expression.js +28 -0
  42. package/out/cst/expression/identified_expression.js.map +1 -0
  43. package/out/cst/expression/if_expression.js +133 -0
  44. package/out/cst/expression/if_expression.js.map +1 -0
  45. package/out/cst/expression/index.js +74 -0
  46. package/out/cst/expression/index.js.map +1 -0
  47. package/out/cst/expression/index_expression.js +28 -0
  48. package/out/cst/expression/index_expression.js.map +1 -0
  49. package/out/cst/expression/lambda_expression.js +72 -0
  50. package/out/cst/expression/lambda_expression.js.map +1 -0
  51. package/out/cst/expression/let_statement.js +59 -0
  52. package/out/cst/expression/let_statement.js.map +1 -0
  53. package/out/cst/expression/loop_expression.js +27 -0
  54. package/out/cst/expression/loop_expression.js.map +1 -0
  55. package/out/cst/expression/macro_call_expression.js +66 -0
  56. package/out/cst/expression/macro_call_expression.js.map +1 -0
  57. package/out/cst/expression/match_expression.js +86 -0
  58. package/out/cst/expression/match_expression.js.map +1 -0
  59. package/out/cst/expression/move_or_copy_expression.js +27 -0
  60. package/out/cst/expression/move_or_copy_expression.js.map +1 -0
  61. package/out/cst/expression/name_expression.js +26 -0
  62. package/out/cst/expression/name_expression.js.map +1 -0
  63. package/out/cst/expression/pack_expression.js +27 -0
  64. package/out/cst/expression/pack_expression.js.map +1 -0
  65. package/out/cst/expression/return_expression.js +44 -0
  66. package/out/cst/expression/return_expression.js.map +1 -0
  67. package/out/cst/expression/unary_expression.js +26 -0
  68. package/out/cst/expression/unary_expression.js.map +1 -0
  69. package/out/cst/expression/unit_expression.js +17 -0
  70. package/out/cst/expression/unit_expression.js.map +1 -0
  71. package/out/cst/expression/vector_expression.js +80 -0
  72. package/out/cst/expression/vector_expression.js.map +1 -0
  73. package/out/cst/expression/while_expression.js +42 -0
  74. package/out/cst/expression/while_expression.js.map +1 -0
  75. package/out/cst/formatting.js +100 -0
  76. package/out/cst/formatting.js.map +1 -0
  77. package/out/cst/function_definition.js +248 -0
  78. package/out/cst/function_definition.js.map +1 -0
  79. package/out/cst/literal.js +68 -0
  80. package/out/cst/literal.js.map +1 -0
  81. package/out/cst/module.js +158 -0
  82. package/out/cst/module.js.map +1 -0
  83. package/out/cst/source_file.js +38 -0
  84. package/out/cst/source_file.js.map +1 -0
  85. package/out/cst/struct_definition.js +209 -0
  86. package/out/cst/struct_definition.js.map +1 -0
  87. package/out/cst/use_declaration.js +212 -0
  88. package/out/cst/use_declaration.js.map +1 -0
  89. package/out/imports-grouping.js +259 -0
  90. package/out/imports-grouping.js.map +1 -0
  91. package/out/index.js +97 -0
  92. package/out/index.js.map +1 -0
  93. package/out/printer.js +69 -0
  94. package/out/printer.js.map +1 -0
  95. package/out/tree.js +371 -0
  96. package/out/tree.js.map +1 -0
  97. package/out/utilities.js +251 -0
  98. package/out/utilities.js.map +1 -0
  99. package/package.json +34 -0
  100. package/prettier.config.js +12 -0
  101. package/src/cst/annotation.ts +71 -0
  102. package/src/cst/common.ts +430 -0
  103. package/src/cst/constant.ts +110 -0
  104. package/src/cst/enum_definition.ts +73 -0
  105. package/src/cst/expression/abort_expression.ts +35 -0
  106. package/src/cst/expression/annotation_expression.ts +38 -0
  107. package/src/cst/expression/assign_expression.ts +66 -0
  108. package/src/cst/expression/binary_expression.ts +75 -0
  109. package/src/cst/expression/block.ts +72 -0
  110. package/src/cst/expression/block_item.ts +29 -0
  111. package/src/cst/expression/borrow_expression.ts +28 -0
  112. package/src/cst/expression/break_expression.ts +33 -0
  113. package/src/cst/expression/call_expression.ts +28 -0
  114. package/src/cst/expression/cast_expression.ts +35 -0
  115. package/src/cst/expression/continue_expression.ts +29 -0
  116. package/src/cst/expression/dereference_expression.ts +33 -0
  117. package/src/cst/expression/dot_expression.ts +89 -0
  118. package/src/cst/expression/expression_list.ts +28 -0
  119. package/src/cst/expression/identified_expression.ts +30 -0
  120. package/src/cst/expression/if_expression.ts +177 -0
  121. package/src/cst/expression/index.ts +85 -0
  122. package/src/cst/expression/index_expression.ts +37 -0
  123. package/src/cst/expression/lambda_expression.ts +84 -0
  124. package/src/cst/expression/let_statement.ts +73 -0
  125. package/src/cst/expression/loop_expression.ts +29 -0
  126. package/src/cst/expression/macro_call_expression.ts +79 -0
  127. package/src/cst/expression/match_expression.ts +102 -0
  128. package/src/cst/expression/move_or_copy_expression.ts +29 -0
  129. package/src/cst/expression/name_expression.ts +28 -0
  130. package/src/cst/expression/pack_expression.ts +29 -0
  131. package/src/cst/expression/return_expression.ts +50 -0
  132. package/src/cst/expression/unary_expression.ts +28 -0
  133. package/src/cst/expression/unit_expression.ts +18 -0
  134. package/src/cst/expression/vector_expression.ts +97 -0
  135. package/src/cst/expression/while_expression.ts +45 -0
  136. package/src/cst/formatting.ts +100 -0
  137. package/src/cst/function_definition.ts +300 -0
  138. package/src/cst/literal.ts +69 -0
  139. package/src/cst/module.ts +191 -0
  140. package/src/cst/source_file.ts +38 -0
  141. package/src/cst/struct_definition.ts +267 -0
  142. package/src/cst/use_declaration.ts +238 -0
  143. package/src/imports-grouping.ts +300 -0
  144. package/src/index.ts +119 -0
  145. package/src/printer.ts +93 -0
  146. package/src/tree.ts +438 -0
  147. package/src/utilities.ts +387 -0
  148. package/tree-sitter-move.wasm +0 -0
  149. package/tsconfig.json +26 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,67 @@
1
+ # @haneullabs/prettier-plugin-move
2
+
3
+ ## 0.3.3
4
+
5
+ ### Patch Changes
6
+
7
+ - fix incorrect label assignment when extend + regular modules are mixed in the same file
8
+
9
+ ## 0.3.2
10
+
11
+ ### Patch Changes
12
+
13
+ - fix issue with clearing out comments after last variant in an `enum_definition`
14
+ - switch to newer tree-sitter with support for `extend` keyword
15
+
16
+ ## 0.3.1
17
+
18
+ ### Patch Changes
19
+
20
+ - migrate to better tree-sitter version
21
+
22
+ ## 0.3.0
23
+
24
+ ### Minor Changes
25
+
26
+ - `dot_expression` now supports trailing comment in a list
27
+ - a single element of an `arg_list` can have **trailing** line comment
28
+ - a single element of an `arg_list` can have **leading** line comment
29
+ - trailing comment no longer breaks `vector_expression`
30
+
31
+ `if_expression`:
32
+ - indentation fixed in certain places
33
+ - `if-else` chain is a special behavior
34
+
35
+ ## 0.2.2
36
+
37
+ ### Patch Changes
38
+
39
+ - 3e5cf29: abort + address improvements
40
+
41
+ ## 0.2.1
42
+
43
+ ### Patch Changes
44
+
45
+ - 360e9a2: Fixes missing parser for move-parser error
46
+
47
+ ## 0.2.0
48
+
49
+ ### Minor Changes
50
+
51
+ - 53387ff: - parser rename "move-parser" -> "move"
52
+ - adds `prettier-move` bin when installed globally
53
+ - better comments handling in empty blocks
54
+ - sorts abilities alphabetically, but `key` always first
55
+ - no longer inserts block in `if_expression` if expression breaks
56
+
57
+ ## 0.1.1
58
+
59
+ ### Patch Changes
60
+
61
+ - e1a85c2: fixes publishing issue, compiles prepublish
62
+
63
+ ## 0.1.0
64
+
65
+ ### Minor Changes
66
+
67
+ - 9521492: Initial version of the prettier-plugin-move
@@ -0,0 +1,31 @@
1
+ # Contributing
2
+
3
+ If you decide to contribute to this project, please choose the scope of your contribution (e.g.,
4
+ implement formatting for structs) and file an issue in the Sui
5
+ [repository](https://github.com/GeunhwaJeong/haneul) describing the work you plan to do, and wait for a
6
+ response from a core team member so that we can avoid duplication of efforts.
7
+
8
+ Please make sure that the code you add is well documented and that you add relevant tests - please
9
+ use existing code as guidance.
10
+
11
+ ## Build and Test
12
+
13
+ To run build and test, use these commands:
14
+
15
+ ```shell
16
+ pnpm build
17
+ pnpm test
18
+ ```
19
+
20
+ ## Updating Snapshots
21
+
22
+ To update snapshots in tests, use `UB=1` (update baseline) env variable:
23
+
24
+ ```shell
25
+ UB=1 pnpm test
26
+ ```
27
+
28
+ ## Changeset
29
+
30
+ Make sure to run `pnpm changeset` with appropriate version for the changes made. Commit the change,
31
+ so that it is picked up by CI.
package/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # Prettier Move Plugin
2
+
3
+ This is a Move language plugin for the
4
+ [Prettier](https://prettier.io/) code formatter. It uses a Move
5
+ [parser](https://github.com/tzakian/tree-sitter-move) built on top of the
6
+ [tree-sitter](https://tree-sitter.github.io/) parser generator and maintained by Tim Zakian.
7
+
8
+ The plugin is platform-independent by utilizing a [WASM](https://webassembly.org/)-ified version of
9
+ the Move parser included in this repository at
10
+ [(./tree-sitter-move.wasm)](./tree-sitter-move.wasm). You can re-generate the WASM-ified version of
11
+ the parser by running the [scripts/treesitter-wasm-gen.sh](scripts/treesitter-wasm-gen.sh) script
12
+ (prerequisites for this are listed in the script itself). You should be careful when doing so, as
13
+ certain changes to the parser may break the plugin (e.g., if parse tree node types are modified).
14
+
15
+ ## Prerequisites
16
+
17
+ Requires [nodejs 18+](https://nodejs.org/en) installed.
18
+
19
+ ## Usage (Global, CLI)
20
+
21
+ For CLI usage, you can install the plugin globally by running the following command:
22
+
23
+ ```bash
24
+ npm i -g prettier @haneullabs/prettier-plugin-move
25
+ ```
26
+
27
+ Then there will be a registered executable `prettier-move` which works exactly like a regular `prettier` one, except that it automatically inserts the path to the plugin as an argument.
28
+
29
+ ```bash
30
+ prettier-move -c sources/example.move # to check
31
+ prettier-move -w sources/example.move # to write
32
+ ```
33
+
34
+ This command is identical to the following:
35
+
36
+ ```bash
37
+ prettier --plugin /path/to/local/npm/node_modules/@haneullabs/prettier-plugin-move/out/index.js -c sources/example.move # to check
38
+ prettier --plugin /path/to/local/npm/node_modules/@haneullabs/prettier-plugin-move/out/index.js -w sources/example.move # to write
39
+ ```
40
+
41
+ ## Installation (Per-Project)
42
+
43
+ If you decide to use the plugin per-project, you can install it in the project's directory. This way,
44
+ the plugin will be available via `prettier` call in the project's directory.
45
+
46
+ ```bash
47
+ # install as a dev-dependency
48
+ npm i -D prettier @haneullabs/prettier-plugin-move
49
+ ```
50
+
51
+ Add the `.prettierrc` or a similar configuration file (see [all supported formats](https://prettier.io/docs/en/configuration.html)):
52
+
53
+ ```json
54
+ {
55
+ "printWidth": 100,
56
+ "tabWidth": 4,
57
+ "useModuleLabel": true,
58
+ "autoGroupImports": "module",
59
+ "plugins": ["@haneullabs/prettier-plugin-move"]
60
+ }
61
+ ```
62
+
63
+ Then you can run prettier either via adding a script to `package.json`:
64
+
65
+ ```json
66
+ {
67
+ "scripts": {
68
+ "prettier": "prettier --write ."
69
+ }
70
+ }
71
+ ```
72
+
73
+ ```bash
74
+ npm run prettier -w sources/example.move
75
+ ```
76
+
77
+ Or, if you have prettier installed globally, you can run it directly:
78
+
79
+ ```bash
80
+ prettier --write sources/example.move
81
+ ```
82
+
83
+ ## VSCode integration
84
+
85
+ There is a bundled [Move Formatter](https://marketplace.visualstudio.com/items?itemName=mysten.prettier-move) extension for VSCode. It will detect prettier configuration for the workspace and use
86
+ the plugin automatically.
87
+
88
+ Alternatively, if you follow the per-project installation, [regular Pretter extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) should work as well.
89
+
90
+ ## Known Integrations
91
+
92
+ - Neovim: see [this commit](https://github.com/amnn/nvim/commit/26236dc08162b61f95f689e232a5df2418708339) for configuration
93
+
94
+ ## Contribute
95
+
96
+ See [CONTRIBUTING](./CONTRIBUTING.md).
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env node
2
+
3
+ // use the
4
+ const path = require('path');
5
+ const plugin_path = path.resolve(__dirname, '..', 'out', 'index.js');
6
+ const child_process = require('child_process');
7
+
8
+ // command is prettier + plugin path + args passed to the script
9
+ const args = process.argv.slice(2);
10
+
11
+ // check that prettier is installed
12
+ try {
13
+ child_process.execFileSync('prettier', ['--version']);
14
+ } catch (e) {
15
+ console.error('Prettier is not installed. Please install it by running `npm install -g prettier`.');
16
+ process.exit(1);
17
+ }
18
+
19
+ // run prettier, print the output and exit with correct code
20
+ const prettier = child_process.execFile(
21
+ 'prettier',
22
+ args.length ? ['--plugin', plugin_path, ...args] : ['--help'],
23
+ );
24
+
25
+ // additionally, exchange stdin/stdout/stderr with the prettier process
26
+ process.stdin.pipe(prettier.stdin);
27
+ prettier.stdout.pipe(process.stdout);
28
+ prettier.stderr.pipe(process.stderr);
29
+ prettier.on('exit', (code) => process.exit(code));
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ // Copyright (c) The Move Contributors
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.Annotation = void 0;
6
+ exports.default = default_1;
7
+ exports.printAnnotation = printAnnotation;
8
+ exports.printAnnotationItem = printAnnotationItem;
9
+ exports.printAnnotationList = printAnnotationList;
10
+ exports.printAnnotationExpr = printAnnotationExpr;
11
+ const prettier_1 = require("prettier");
12
+ const utilities_1 = require("../utilities");
13
+ const { group, join } = prettier_1.doc.builders;
14
+ var Annotation;
15
+ (function (Annotation) {
16
+ Annotation["Annotation"] = "annotation";
17
+ Annotation["AnnotationItem"] = "annotation_item";
18
+ Annotation["AnnotationList"] = "annotation_list";
19
+ Annotation["AnnotationExpr"] = "annotation_expr";
20
+ })(Annotation || (exports.Annotation = Annotation = {}));
21
+ function default_1(path) {
22
+ switch (path.node.type) {
23
+ case Annotation.Annotation:
24
+ return printAnnotation;
25
+ case Annotation.AnnotationItem:
26
+ return printAnnotationItem;
27
+ case Annotation.AnnotationList:
28
+ return printAnnotationList;
29
+ case Annotation.AnnotationExpr:
30
+ return printAnnotationExpr;
31
+ }
32
+ return null;
33
+ }
34
+ /**
35
+ * Print `annotation` node.
36
+ */
37
+ function printAnnotation(path, options, print) {
38
+ return group(['#', (0, utilities_1.list)({ path, print, options, open: '[', close: ']' })]);
39
+ }
40
+ /**
41
+ * Print `annotation_item` node.
42
+ */
43
+ function printAnnotationItem(path, _opt, print) {
44
+ return path.map(print, 'nonFormattingChildren');
45
+ }
46
+ function printAnnotationList(path, options, print) {
47
+ return [
48
+ path.call(print, 'nonFormattingChildren', 0),
49
+ (0, utilities_1.list)({ path, print, options, open: '(', close: ')', skipChildren: 1 }),
50
+ ];
51
+ }
52
+ /**
53
+ * Print `annotation_expr` node.
54
+ */
55
+ function printAnnotationExpr(path, _opt, print) {
56
+ // allow `::module::Expression` in annotations
57
+ return join(' = ', path.map((path) => {
58
+ if (path.node.type === 'module_access' && path.node.previousSibling?.type == '::') {
59
+ return ['::', path.call(print)];
60
+ }
61
+ return path.call(print);
62
+ }, 'nonFormattingChildren'));
63
+ }
64
+ //# sourceMappingURL=annotation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"annotation.js","sourceRoot":"","sources":["../../src/cst/annotation.ts"],"names":[],"mappings":";AAAA,sCAAsC;AACtC,sCAAsC;;;AAetC,4BAaC;AAKD,0CAEC;AAKD,kDAEC;AAED,kDASC;AAKD,kDAWC;AAjED,uCAA6C;AAC7C,4CAAoC;AACpC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,cAAG,CAAC,QAAQ,CAAC;AAErC,IAAY,UAKX;AALD,WAAY,UAAU;IAClB,uCAAyB,CAAA;IACzB,gDAAkC,CAAA;IAClC,gDAAkC,CAAA;IAClC,gDAAkC,CAAA;AACtC,CAAC,EALW,UAAU,0BAAV,UAAU,QAKrB;AAED,mBAAyB,IAAmB;IACxC,QAAQ,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACrB,KAAK,UAAU,CAAC,UAAU;YACtB,OAAO,eAAe,CAAC;QAC3B,KAAK,UAAU,CAAC,cAAc;YAC1B,OAAO,mBAAmB,CAAC;QAC/B,KAAK,UAAU,CAAC,cAAc;YAC1B,OAAO,mBAAmB,CAAC;QAC/B,KAAK,UAAU,CAAC,cAAc;YAC1B,OAAO,mBAAmB,CAAC;IACnC,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,SAAgB,eAAe,CAAC,IAAmB,EAAE,OAAoB,EAAE,KAAc;IACrF,OAAO,KAAK,CAAC,CAAC,GAAG,EAAE,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;AAC/E,CAAC;AAED;;GAEG;AACH,SAAgB,mBAAmB,CAAC,IAAmB,EAAE,IAAiB,EAAE,KAAc;IACtF,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,uBAAuB,CAAC,CAAC;AACpD,CAAC;AAED,SAAgB,mBAAmB,CAC/B,IAAmB,EACnB,OAAoB,EACpB,KAAc;IAEd,OAAO;QACH,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,uBAAuB,EAAE,CAAC,CAAC;QAC5C,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,YAAY,EAAE,CAAC,EAAE,CAAC;KACzE,CAAC;AACN,CAAC;AAED;;GAEG;AACH,SAAgB,mBAAmB,CAAC,IAAmB,EAAE,IAAiB,EAAE,KAAc;IACtF,8CAA8C;IAC9C,OAAO,IAAI,CACP,KAAK,EACL,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACd,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,eAAe,IAAI,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,IAAI,IAAI,EAAE,CAAC;YAChF,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC,EAAE,uBAAuB,CAAC,CAC9B,CAAC;AACN,CAAC"}
@@ -0,0 +1,376 @@
1
+ "use strict";
2
+ // Copyright (c) The Move Contributors
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.Common = void 0;
6
+ exports.default = default_1;
7
+ exports.printPrimitiveType = printPrimitiveType;
8
+ exports.printModuleAccess = printModuleAccess;
9
+ exports.printRefType = printRefType;
10
+ exports.printAbility = printAbility;
11
+ exports.printTupleType = printTupleType;
12
+ exports.printAlias = printAlias;
13
+ const prettier_1 = require("prettier");
14
+ const utilities_1 = require("../utilities");
15
+ const { group, join, line, indent, hardline } = prettier_1.doc.builders;
16
+ /**
17
+ * Creates a callback function to print common nodes.
18
+ */
19
+ function default_1(path) {
20
+ switch (path.node.type) {
21
+ case Common.PrimitiveType:
22
+ return printPrimitiveType;
23
+ case Common.ModuleAccess:
24
+ return printModuleAccess;
25
+ // identifiers
26
+ case Common.Identifier:
27
+ case Common.FieldIdentifier:
28
+ case Common.VariableIdentifier:
29
+ return utilities_1.printIdentifier;
30
+ case Common.RefType:
31
+ return printRefType;
32
+ case Common.FunctionType:
33
+ return printFunctionType;
34
+ case Common.FunctionTypeParameters:
35
+ return printFunctionTypeParameters;
36
+ case Common.Ability:
37
+ return printAbility;
38
+ case Common.TupleType:
39
+ return printTupleType;
40
+ // === Bindings ===
41
+ case Common.BindUnpack:
42
+ return printBindUnpack;
43
+ case Common.BindFields:
44
+ return printBindFields;
45
+ case Common.MutBindField:
46
+ return printMutBindField;
47
+ case Common.BindField:
48
+ return printBindField;
49
+ case Common.BindList:
50
+ return printBindList;
51
+ case Common.CommaBindList:
52
+ return printCommaBindList;
53
+ case Common.OrBindList:
54
+ return printOrBindList;
55
+ case Common.AtBind:
56
+ return printAtBind;
57
+ case Common.BindNamedFields:
58
+ return printBindNamedFields;
59
+ case Common.BindPositionalFields:
60
+ return printBindPositionalFields;
61
+ case Common.BindVar:
62
+ return printBindVar;
63
+ case Common.MutBindVar:
64
+ return printMutBindVar;
65
+ case Common.ImmRef:
66
+ return printImmRef;
67
+ case Common.MutRef:
68
+ return printMutRef;
69
+ case Common.Label:
70
+ return printLabel;
71
+ case Common.Alias:
72
+ return printAlias;
73
+ case Common.BlockIdentifier:
74
+ return printBlockIdentifier;
75
+ case Common.UnaryOperator:
76
+ return printUnaryOperator;
77
+ case Common.FieldInitializeList:
78
+ return printFieldInitializeList;
79
+ case Common.ExpressionField:
80
+ return printExpressionField;
81
+ case Common.ArgList:
82
+ return printArgList;
83
+ }
84
+ return null;
85
+ }
86
+ /**
87
+ * Nodes which are used across multiple files, yet can't be categorized.
88
+ */
89
+ var Common;
90
+ (function (Common) {
91
+ Common["PrimitiveType"] = "primitive_type";
92
+ Common["VariableIdentifier"] = "variable_identifier";
93
+ Common["ModuleAccess"] = "module_access";
94
+ Common["Identifier"] = "identifier";
95
+ Common["RefType"] = "ref_type";
96
+ Common["FunctionType"] = "function_type";
97
+ Common["FunctionTypeParameters"] = "function_type_parameters";
98
+ Common["FieldIdentifier"] = "field_identifier";
99
+ Common["BlockIdentifier"] = "block_identifier";
100
+ Common["Ability"] = "ability";
101
+ Common["TupleType"] = "tuple_type";
102
+ // === Bindings ===
103
+ Common["BindUnpack"] = "bind_unpack";
104
+ Common["BindFields"] = "bind_fields";
105
+ Common["MutBindField"] = "mut_bind_field";
106
+ Common["BindField"] = "bind_field";
107
+ Common["BindList"] = "bind_list";
108
+ Common["BindNamedFields"] = "bind_named_fields";
109
+ Common["CommaBindList"] = "comma_bind_list";
110
+ Common["OrBindList"] = "or_bind_list";
111
+ Common["AtBind"] = "at_bind";
112
+ Common["BindPositionalFields"] = "bind_positional_fields";
113
+ Common["BindVar"] = "bind_var";
114
+ Common["MutBindVar"] = "mut_bind_var";
115
+ Common["ImmRef"] = "imm_ref";
116
+ Common["MutRef"] = "mut_ref";
117
+ Common["Label"] = "label";
118
+ Common["Alias"] = "alias";
119
+ Common["UnaryOperator"] = "unary_op";
120
+ Common["FieldInitializeList"] = "field_initialize_list";
121
+ Common["ExpressionField"] = "exp_field";
122
+ // used in `call_expression` and `macro_call_expression`
123
+ Common["ArgList"] = "arg_list";
124
+ })(Common || (exports.Common = Common = {}));
125
+ /**
126
+ * Print `primitive_type` node.
127
+ */
128
+ function printPrimitiveType(path, _opt, _p) {
129
+ return path.node.text;
130
+ }
131
+ /**
132
+ * Print `module_access` node.
133
+ */
134
+ function printModuleAccess(path, _opt, print) {
135
+ return path.map(print, 'children');
136
+ }
137
+ /**
138
+ * Print `ref_type` node.
139
+ */
140
+ function printRefType(path, _opt, print) {
141
+ return group([
142
+ path.call(print, 'nonFormattingChildren', 0), // ref_type
143
+ path.call(print, 'nonFormattingChildren', 1), // type
144
+ ]);
145
+ }
146
+ /**
147
+ * Print `arg_list` node.
148
+ */
149
+ function printArgList(path, options, print) {
150
+ const nodes = path.node.nonFormattingChildren;
151
+ if (nodes.length === 1 && nodes[0].isBreakableExpression) {
152
+ const child = nodes[0];
153
+ const shouldBreak = nodes[0]?.trailingComment?.type === 'line_comment' ||
154
+ nodes[0]?.leadingComment.some((e) => e.type === 'line_comment');
155
+ if (shouldBreak) {
156
+ return [
157
+ '(',
158
+ indent(hardline),
159
+ indent(path.call(print, 'nonFormattingChildren', 0)),
160
+ hardline,
161
+ ')',
162
+ ];
163
+ }
164
+ return ['(', path.call(print, 'nonFormattingChildren', 0), ')'];
165
+ }
166
+ return group((0, utilities_1.list)({ path, print, options, open: '(', close: ')' }), {
167
+ shouldBreak: (0, utilities_1.shouldBreakFirstChild)(path),
168
+ });
169
+ }
170
+ /**
171
+ * Print `ability` node.
172
+ */
173
+ function printAbility(path, _opt, _p) {
174
+ return path.node.text;
175
+ }
176
+ /**
177
+ * Print `tuple_type` node.
178
+ */
179
+ function printTupleType(path, options, print) {
180
+ return group((0, utilities_1.list)({
181
+ path,
182
+ print,
183
+ options,
184
+ open: '(',
185
+ close: ')',
186
+ shouldBreak: false,
187
+ }));
188
+ }
189
+ // === Bindings ===
190
+ /**
191
+ * Print `bind_unpack` node.
192
+ * For easier seach: `unpack_expression`.
193
+ *
194
+ * Inside:
195
+ * - `bind_var`
196
+ * - `bind_fields`
197
+ * - `bind_fields`
198
+ *
199
+ * `let Struct { field1, field2 } = ...;`
200
+ */
201
+ function printBindUnpack(path, _opt, print) {
202
+ return path.map(print, 'nonFormattingChildren');
203
+ }
204
+ /**
205
+ * Print `bind_fields` node.
206
+ * Choice node between `bind_named_fields` and `bind_positional_fields`.
207
+ */
208
+ function printBindFields(path, _opt, print) {
209
+ return path.call(print, 'nonFormattingChildren', 0);
210
+ }
211
+ /**
212
+ * Print `bind_field` node.
213
+ */
214
+ function printBindField(path, _opt, print) {
215
+ // special case for `..` operator
216
+ if (path.node.child(0)?.type == '..') {
217
+ return '..';
218
+ }
219
+ // if there's only one child, we can just print it
220
+ // if there're two, they will be joined
221
+ return join(': ', path.map(print, 'nonFormattingChildren'));
222
+ }
223
+ /**
224
+ * Print `mut_bind_field` node.
225
+ */
226
+ function printMutBindField(path, _opt, print) {
227
+ return ['mut ', path.call(print, 'nonFormattingChildren', 0)];
228
+ }
229
+ /**
230
+ * Print `bind_list` node.
231
+ * In the bind list we have two paths:
232
+ *
233
+ * - one is just `bind_var` with potential `mut`
234
+ * - another is a list, and we know it because the first member is `(`.
235
+ */
236
+ function printBindList(path, options, print) {
237
+ if (path.node.nonFormattingChildren.length == 1) {
238
+ return join(' ', path.map(print, 'nonFormattingChildren'));
239
+ }
240
+ return group((0, utilities_1.list)({ path, print, options, open: '(', close: ')' }));
241
+ }
242
+ /**
243
+ * Print `comma_bind_list` node.
244
+ */
245
+ function printCommaBindList(path, options, print) {
246
+ return group((0, utilities_1.list)({ path, print, options, open: '(', close: ')' }));
247
+ }
248
+ /**
249
+ * Print `at_bind` node.
250
+ */
251
+ function printAtBind(path, _opt, print) {
252
+ return join(' @ ', path.map(print, 'nonFormattingChildren'));
253
+ }
254
+ /**
255
+ * Print `or_bind_list` node.
256
+ */
257
+ function printOrBindList(path, options, print) {
258
+ return group(join([' |', line], path.map(print, 'nonFormattingChildren')));
259
+ }
260
+ /**
261
+ * Print `bind_named_fields` node.
262
+ */
263
+ function printBindNamedFields(path, options, print) {
264
+ return [
265
+ ' ',
266
+ group((0, utilities_1.list)({ path, print, options, open: '{', close: '}', addWhitespace: true }), {
267
+ shouldBreak: (0, utilities_1.shouldBreakFirstChild)(path),
268
+ }),
269
+ ];
270
+ }
271
+ /**
272
+ * Print `bind_positional_fields` node.
273
+ */
274
+ function printBindPositionalFields(path, options, print) {
275
+ return group((0, utilities_1.list)({ path, print, options, open: '(', close: ')' }), {
276
+ shouldBreak: (0, utilities_1.shouldBreakFirstChild)(path),
277
+ });
278
+ }
279
+ /**
280
+ * Print `bind_var` node.
281
+ */
282
+ function printBindVar(path, _opt, print) {
283
+ return path.call(print, 'nonFormattingChildren', 0);
284
+ }
285
+ /**
286
+ * Print `mut_bind_var` node.
287
+ */
288
+ function printMutBindVar(path, _opt, print) {
289
+ return ['mut ', path.call(print, 'nonFormattingChildren', 0)];
290
+ }
291
+ /**
292
+ * Print `imm_ref` node.
293
+ */
294
+ function printImmRef(path, _opt, print) {
295
+ return '&';
296
+ }
297
+ /**
298
+ * Print `mut_ref` node.
299
+ */
300
+ function printMutRef(path, _opt, print) {
301
+ return '&mut ';
302
+ }
303
+ /**
304
+ * Print `alias` node. ...as `identifier`
305
+ */
306
+ function printAlias(path, _opt, print) {
307
+ return ['as ', path.call(print, 'nonFormattingChildren', 0)];
308
+ }
309
+ /**
310
+ * Print `block_identifier` node.
311
+ */
312
+ function printBlockIdentifier(path, _opt, print) {
313
+ return path.call(print, 'nonFormattingChildren', 0);
314
+ }
315
+ /**
316
+ * Print `label` node.
317
+ */
318
+ function printLabel(path, _opt, _p) {
319
+ if (path.node.nextSibling?.type == ':') {
320
+ return [path.node.text, ':'];
321
+ }
322
+ return path.node.text;
323
+ }
324
+ /**
325
+ * Print `unary_op` node.
326
+ */
327
+ function printUnaryOperator(path, _opt, _p) {
328
+ return path.node.text;
329
+ }
330
+ /**
331
+ * Print `field_initialize_list` node.
332
+ */
333
+ function printFieldInitializeList(path, options, print) {
334
+ return [
335
+ ' ',
336
+ group((0, utilities_1.list)({ path, print, options, open: '{', close: '}', addWhitespace: true }), {
337
+ shouldBreak: (0, utilities_1.shouldBreakFirstChild)(path),
338
+ }),
339
+ ];
340
+ }
341
+ /**
342
+ * Print `expression_field` node.
343
+ * Inside:
344
+ * - `field_identifier`
345
+ * - `expression`
346
+ */
347
+ function printExpressionField(path, _opt, print) {
348
+ const children = path.map(print, 'nonFormattingChildren');
349
+ if (children.length === 1) {
350
+ return children[0];
351
+ }
352
+ return group([children[0], ': ', children[1]]);
353
+ }
354
+ /**
355
+ * Print `function_type` node.
356
+ * Inside:
357
+ * - `function_type_parameters`
358
+ * - `return_type`
359
+ */
360
+ function printFunctionType(path, _opt, print) {
361
+ const children = path.map(print, 'nonFormattingChildren');
362
+ if (children.length === 0) {
363
+ return '||';
364
+ }
365
+ if (children.length === 1) {
366
+ return children[0];
367
+ }
368
+ return join(' -> ', children);
369
+ }
370
+ /**
371
+ * Print `function_type_parameters` node.
372
+ */
373
+ function printFunctionTypeParameters(path, options, print) {
374
+ return group((0, utilities_1.list)({ path, print, options, open: '|', close: '|' }));
375
+ }
376
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/cst/common.ts"],"names":[],"mappings":";AAAA,sCAAsC;AACtC,sCAAsC;;;AAWtC,4BA0EC;AAiDD,gDAEC;AAKD,8CAEC;AAKD,oCAKC;AAmCD,oCAEC;AAKD,wCAWC;AAwID,gCAEC;AApVD,uCAA6C;AAC7C,4CAA4E;AAC5E,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,cAAG,CAAC,QAAQ,CAAC;AAE7D;;GAEG;AACH,mBAAyB,IAAmB;IACxC,QAAQ,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACrB,KAAK,MAAM,CAAC,aAAa;YACrB,OAAO,kBAAkB,CAAC;QAC9B,KAAK,MAAM,CAAC,YAAY;YACpB,OAAO,iBAAiB,CAAC;QAE7B,cAAc;QACd,KAAK,MAAM,CAAC,UAAU,CAAC;QACvB,KAAK,MAAM,CAAC,eAAe,CAAC;QAC5B,KAAK,MAAM,CAAC,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