Skip to content

Commit 88ebeba

Browse files
committed
doc: Add troubleshoot section
1 parent f6db058 commit 88ebeba

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ Services.install({
2828
})
2929
```
3030

31+
## Monaco standalone services
32+
3133
Also, monaco-editor use `standalone` versions or the vscode services, which are much simpler.
3234

3335
You may want to provide your custom implementations of them, especially for: `textModelService`, `codeEditorService` and `notificationService`. To do so, you can provide them as the third parameter while creating your first editor.
@@ -64,12 +66,17 @@ StandaloneServices.initialize({
6466
// It will be called when for instance the user ctrl+click on an import
6567
}),
6668
...getMessageServiceOverride(document.body),
67-
...getConfigurationServiceOverride(readConfiguration, configurationChangeEvent)
69+
...getConfigurationServiceOverride(() => userConfigurationJson, configurationChangeEvent)
6870
})
6971
```
7072

7173
Note: using `vscode/service-override/modelEditor`, you'll be able to use the `vscode.workspace.registerTextDocumentContentProvider` api
7274

75+
### Troubleshoot
76+
77+
`StandaloneServices.initialize` can only be called once (note that `monaco.editor.create` calls `StandaloneServices.initialize`).
78+
79+
Also, a service that is used cannot be overriden anymore. So `StandaloneServices.initialize` should be called as soon as possible to prevent most of the issues.
7380
### Installation
7481

7582
```bash

0 commit comments

Comments
 (0)