@codingame/monaco-vscode-api 1.67.14 → 1.67.17
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 +36 -3
- package/dist/api.js +1279 -97
- package/dist/async-c7fd4178.js +212 -0
- package/dist/configuration.d.ts +292 -0
- package/dist/configuration.js +2178 -0
- package/dist/messages.d.ts +3 -3
- package/dist/messages.js +14 -6
- package/dist/{missing-services-0f9c8f22.js → missing-services-597951f0.js} +357 -31
- package/dist/modelEditor.d.ts +1 -3
- package/dist/modelEditor.js +25 -20
- package/dist/monaco.d.ts +2683 -0
- package/dist/monaco.js +149 -0
- package/dist/position-291dfe99.js +3 -0
- package/dist/{services-621e567e.js → services-9299c4ca.js} +264 -21
- package/dist/services.d.ts +327 -331
- package/dist/services.js +4 -2
- package/dist/tslib.es6-16b40665.js +21 -0
- package/dist/types-371cc315.js +27 -0
- package/package.json +15 -1
- package/dist/async-9ffe4d42.js +0 -46
package/README.md
CHANGED
|
@@ -28,6 +28,8 @@ Services.install({
|
|
|
28
28
|
})
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
+
## Monaco standalone services
|
|
32
|
+
|
|
31
33
|
Also, monaco-editor use `standalone` versions or the vscode services, which are much simpler.
|
|
32
34
|
|
|
33
35
|
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.
|
|
@@ -46,27 +48,58 @@ StandaloneService.initialize({
|
|
|
46
48
|
})
|
|
47
49
|
```
|
|
48
50
|
|
|
49
|
-
Additionally, this library exposes
|
|
51
|
+
Additionally, this library exposes 3 modules that include the vscode version of some services (with some glue to make it work with monaco):
|
|
50
52
|
- Notification / Dialog: `vscode/service-override/messages`
|
|
51
53
|
- Model / Editor: `vscode/service-override/modelEditor`
|
|
54
|
+
- Configuration: `vscode/service-override/configuration`
|
|
52
55
|
|
|
53
56
|
Usage:
|
|
54
57
|
```typescript
|
|
55
58
|
import { StandaloneService } from 'vscode/services'
|
|
56
59
|
import getModelEditorServiceOverride from 'vscode/service-override/modelEditor'
|
|
57
60
|
import getMessageServiceOverride from 'vscode/service-override/messages'
|
|
61
|
+
import getConfigurationServiceOverride from 'vscode/service-override/configuration'
|
|
58
62
|
|
|
59
63
|
StandaloneServices.initialize({
|
|
60
64
|
...getModelEditorServiceOverride((model, input, sideBySide) => {
|
|
61
65
|
// Open a new editor here and return it
|
|
62
66
|
// It will be called when for instance the user ctrl+click on an import
|
|
63
67
|
}),
|
|
64
|
-
...getMessageServiceOverride(document.body)
|
|
68
|
+
...getMessageServiceOverride(document.body),
|
|
69
|
+
...getConfigurationServiceOverride(() => userConfigurationJson, configurationChangeEvent)
|
|
65
70
|
})
|
|
66
71
|
```
|
|
67
72
|
|
|
68
73
|
Note: using `vscode/service-override/modelEditor`, you'll be able to use the `vscode.workspace.registerTextDocumentContentProvider` api
|
|
69
74
|
|
|
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.
|
|
80
|
+
|
|
81
|
+
## Editor configuration
|
|
82
|
+
|
|
83
|
+
The editors created using `monaco.editor.create` don't use the configuration from the configurationService.
|
|
84
|
+
|
|
85
|
+
This library exposes functions to create editors binded on the configuration:
|
|
86
|
+
|
|
87
|
+
before:
|
|
88
|
+
```typescript
|
|
89
|
+
import * as monaco from 'monaco-editor'
|
|
90
|
+
monaco.editor.create(...)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
after:
|
|
94
|
+
```typescript
|
|
95
|
+
import { createConfiguredEditor } from 'vscode/monaco'
|
|
96
|
+
|
|
97
|
+
createConfiguredEditor(...)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
`createConfiguredEditor` returns a subclass of what is returned by `monaco.editor.create`, the `updateOptions` method can still be used.
|
|
101
|
+
The only difference is that is will use the `configurationService` as a default configuration
|
|
102
|
+
|
|
70
103
|
### Installation
|
|
71
104
|
|
|
72
105
|
```bash
|
|
@@ -81,7 +114,7 @@ Just import it as if you were in a vscode extension:
|
|
|
81
114
|
```typescript
|
|
82
115
|
import * as vscode from 'vscode'
|
|
83
116
|
|
|
84
|
-
const range = new
|
|
117
|
+
const range = new vscode.Range(...)
|
|
85
118
|
vscode.languages.registerCompletionItemProvider(...)
|
|
86
119
|
```
|
|
87
120
|
|