@markw65/prettier-plugin-monkeyc 1.0.1 → 1.0.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/README.md +13 -9
- package/build/prettier-plugin-monkeyc.cjs +1 -1
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -40,7 +40,12 @@ npm install --global @markw65/prettier-plugin-monkeyc
|
|
|
40
40
|
|
|
41
41
|
### With VSCode
|
|
42
42
|
|
|
43
|
-
Install the Prettier extension from https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode.
|
|
43
|
+
Install the Prettier extension from https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode.
|
|
44
|
+
|
|
45
|
+
- if you installed the plugin globally, you need to enable `prettier.resolveGlobalModules` in your settings.
|
|
46
|
+
- if you installed locally, [the documentation](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) says it should just work, but I've found you need to tell the extension how to find the local copy of prettier. Put `"prettier.prettierPath": "./node_modules/prettier"` in your `.vscode/settings.json`.
|
|
47
|
+
|
|
48
|
+
Once configured as above, VSCode's `Format Document` command (`Option-Shift-F`) will reformat your .mc files for you.
|
|
44
49
|
|
|
45
50
|
### With Node.js
|
|
46
51
|
|
|
@@ -71,10 +76,10 @@ npm run build-release
|
|
|
71
76
|
To develop, run
|
|
72
77
|
|
|
73
78
|
```
|
|
74
|
-
npm run
|
|
79
|
+
npm run watch
|
|
75
80
|
```
|
|
76
81
|
|
|
77
|
-
You can then execute Prettier with
|
|
82
|
+
This will keep your build up to date as you make changes. You can then execute Prettier with
|
|
78
83
|
|
|
79
84
|
```
|
|
80
85
|
npx prettier [ --write ] --plugin build/prettier-plugin-monkeyc.cjs ...
|
|
@@ -85,12 +90,11 @@ npx prettier [ --write ] --plugin build/prettier-plugin-monkeyc.cjs ...
|
|
|
85
90
|
`@markw65/prettier-plugin-monkeyc` uses a Peggy grammar (located in `peg/`)
|
|
86
91
|
to parse monkeyc. This grammar was originally copied from the Peggy sample javascript grammar, and still has some javascript features that aren't relevant to monkeyc. I'm planning to clean that up, but for now it shouldn't matter.
|
|
87
92
|
|
|
88
|
-
`@markw65/prettier-plugin-monkeyc` is written in native ES6 javascript,
|
|
93
|
+
`@markw65/prettier-plugin-monkeyc` is written in native ES6 javascript, but uses webpack to dynamically compile to commonjs, because thats what prettier wants.
|
|
89
94
|
|
|
90
95
|
The plugin is organized as follows:
|
|
91
96
|
|
|
92
|
-
- `prettier-plugin-monkeyc.js` This file exports the objects required of a
|
|
93
|
-
|
|
94
|
-
- `
|
|
95
|
-
|
|
96
|
-
format that Prettier uses). This is currently a thin wrapper around Prettier's default, estree printer. It handles just the nodes that it needs to, and delegates to "javascript-like" behavior for everything else.
|
|
97
|
+
- `prettier-plugin-monkeyc.js` This file exports the objects required of a Prettier plugin.
|
|
98
|
+
- `peg/monkeyc.peggy` The Peggy grammar for monkey-c.
|
|
99
|
+
- `src/printer.js` Printers take an AST and produce a Doc (the intermediate
|
|
100
|
+
format that Prettier uses). The current implementation is a thin wrapper around Prettier's default, estree printer. It handles just the nodes that it needs to, and delegates to "javascript-like" behavior for everything else.
|