You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|**code**|`string` <br /><br /> The current code in the Monaco editor. This value updates on change to the Monaco editor with optional debouncing. Alias for `sandbox.getText()`|
88
-
|**setCode**|`(code: string) => void` <br /><br /> Set the code in the Monaco editor. Alias for `sandbox.setText()`|
88
+
|**setCode**| `(code: string, options: {format: "prettier" | "monaco"}) => void` <br /><br /> Set the code in the Monaco editor with optional formatting with Prettier or Monaco. Alias for `sandbox.setText()` |
89
89
|**formatCode**|`() => void` <br /><br /> Format the code in the Monaco editor. Alias for `sandbox.editor.getAction("editor.action.formatDocument").run()`|
90
-
|**markers**|`IMarker[]` <br /><br /> Alias for `sandbox.monaco.editor.getModelMarkers({})` that is kept in sync via `sandbox.editor.onDidChangeModelDecorations`. |
90
+
| **prettier** | `prettier(config?: Options) => string` <br /><br /> Format the code in the Monaco editor with prettier. Accepts a prettier config object.
91
+
|**markers**|`(IMarker & {key: string})[]` <br /><br /> Alias for `sandbox.monaco.editor.getModelMarkers({})` with added unique `key` property. Kept in sync via `sandbox.editor.onDidChangeModelDecorations`. |
91
92
|**setDebounce**|`(debounce: boolean) => void` <br /><br /> Optionally debounce the `modelChange` event from the Plugin API. |
92
93
|**sandbox**|`object` <br /><br /> A DOM library for interacting with TypeScript and JavaScript code, which powers the heart of the TypeScript playground. This object provides several properties and methods to interact with the playground. See all of the available types in `src/plugin/vendor/sandbox.d.ts` and read more about the sandbox at [http://www.typescriptlang.org/v2/dev/sandbox/](http://www.typescriptlang.org/v2/dev/sandbox/). |
93
94
|**modal**|`object` <br /><br /> The model is an object which monaco uses to keep track of text in the editor. You can find the full type definition at `node_modules/monaco-editor/esm/vs/editor/editor.api.d.ts`. |
@@ -97,6 +98,7 @@ This hooks provides all of the method and properties provided by the Plugin API.
97
98
98
99
99
100
101
+
100
102
Here is the [type definition](https://github.com/Microsoft/monaco-editor/blob/master/monaco.d.ts#L875) for `IMarker`:
0 commit comments