@codingame/monaco-vscode-api 1.68.5 → 1.69.0
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 +102 -7
- package/dist/api.js +481 -9576
- package/dist/configuration.d.ts +488 -0
- package/dist/configuration.js +409 -0
- package/dist/extHost.js +14880 -0
- package/dist/files.js +1325 -0
- package/dist/injection.js +15 -0
- package/dist/jsonErrorMessages.js +17 -0
- package/dist/keybindings.d.ts +502 -0
- package/dist/keybindings.js +2352 -0
- package/dist/languageConfiguration.d.ts +158 -0
- package/dist/languageConfiguration.js +929 -0
- package/dist/languageService.js +340 -0
- package/dist/languages.d.ts +477 -0
- package/dist/languages.js +21 -0
- package/dist/layoutService.js +4 -0
- package/dist/messages.d.ts +7 -0
- package/dist/messages.js +3624 -0
- package/dist/missing-services.js +7293 -0
- package/dist/modelEditor.d.ts +164 -0
- package/dist/modelEditor.js +739 -0
- package/dist/monaco.d.ts +4795 -0
- package/dist/monaco.js +243 -0
- package/dist/services.d.ts +14806 -2098
- package/dist/services.js +22 -25
- package/dist/services2.js +423 -0
- package/dist/snippets.d.ts +466 -0
- package/dist/snippets.js +903 -0
- package/dist/textmate.d.ts +682 -0
- package/dist/textmate.js +740 -0
- package/dist/theme.d.ts +22 -0
- package/dist/theme.js +4167 -0
- package/dist/tokenClassification.d.ts +479 -0
- package/dist/tokenClassification.js +304 -0
- package/dist/tokenClassificationRegistry.js +472 -0
- package/dist/tools.js +17 -0
- package/dist/tslib.es6.js +21 -0
- package/dist/workbenchThemeService.js +46 -0
- package/package.json +106 -37
- package/dist/api.amd.js +0 -10066
- package/dist/api.cjs +0 -10107
- package/dist/services.amd.js +0 -33
- package/dist/services.cjs +0 -33
package/README.md
CHANGED
|
@@ -11,19 +11,114 @@ The VSCode api is composed of:
|
|
|
11
11
|
- If it's some advanced features that don't make a lot of sense on Monaco (debug, tests...), it just throws an error when you try to use it.
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
To implement by hands the optional features (
|
|
14
|
+
To implement by hands the optional features (file system, workspace folders, file...), you can use the `Services` namespace from `vscode/services`:
|
|
15
15
|
```typescript
|
|
16
16
|
import { Services } from 'vscode/services'
|
|
17
17
|
Services.install({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
workspace: {
|
|
19
|
+
workspaceFolders: ...,
|
|
20
|
+
createFileSystemWatcher (documentSelector, provider) {
|
|
21
|
+
...
|
|
22
|
+
},
|
|
23
|
+
onDidSaveTextDocument
|
|
24
|
+
},
|
|
25
|
+
window: {
|
|
26
|
+
withProgress: ...
|
|
27
|
+
}
|
|
23
28
|
})
|
|
24
29
|
```
|
|
25
30
|
|
|
31
|
+
## Monaco standalone services
|
|
26
32
|
|
|
33
|
+
Also, monaco-editor use `standalone` versions or the vscode services, which are much simpler.
|
|
34
|
+
|
|
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.
|
|
36
|
+
This library allows you to use a more convenient way using `StandaloneService.initialize`.
|
|
37
|
+
Also, monaco-editor doesn't provide good type for them, so this library does it.
|
|
38
|
+
|
|
39
|
+
Example:
|
|
40
|
+
```typescript
|
|
41
|
+
import { StandaloneService, INotificationService } from 'vscode/services'
|
|
42
|
+
|
|
43
|
+
class MyCustomNotificationService implements INotificationService { ... }
|
|
44
|
+
StandaloneService.initialize({
|
|
45
|
+
get [INotificationService.toString()] () {
|
|
46
|
+
return new MyCustomNotificationService(...)
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Additionally, this library exposes 10 modules that include the vscode version of some services (with some glue to make it work with monaco):
|
|
52
|
+
- Notification / Dialog: `vscode/service-override/messages`
|
|
53
|
+
- Model / Editor: `vscode/service-override/modelEditor`
|
|
54
|
+
- Configuration: `vscode/service-override/configuration`
|
|
55
|
+
- Keybindings: `vscode/service-override/keybindings`
|
|
56
|
+
- Language configuration: `vscode/service-override/languageConfiguration`
|
|
57
|
+
- Languages: `vscode/service-override/languages`
|
|
58
|
+
- Textmate: `vscode/service-override/textmate`
|
|
59
|
+
- Snippets: `vscode/service-override/snippets`
|
|
60
|
+
- VSCode themes: `vscode/service-override/theme`
|
|
61
|
+
- Token classification: `vscode/service-override/tokenClassification`
|
|
62
|
+
|
|
63
|
+
Usage:
|
|
64
|
+
```typescript
|
|
65
|
+
import { StandaloneService } from 'vscode/services'
|
|
66
|
+
import getModelEditorServiceOverride from 'vscode/service-override/modelEditor'
|
|
67
|
+
import getMessageServiceOverride from 'vscode/service-override/messages'
|
|
68
|
+
import getConfigurationServiceOverride, { updateUserConfiguration, configurationRegistry } from 'vscode/service-override/configuration'
|
|
69
|
+
|
|
70
|
+
StandaloneServices.initialize({
|
|
71
|
+
...getModelEditorServiceOverride((model, input, sideBySide) => {
|
|
72
|
+
// Open a new editor here and return it
|
|
73
|
+
// It will be called when for instance the user ctrl+click on an import
|
|
74
|
+
}),
|
|
75
|
+
...getMessageServiceOverride(document.body),
|
|
76
|
+
...getConfigurationServiceOverride()
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
configurationRegistry.registerDefaultConfigurations([{
|
|
80
|
+
overrides: {
|
|
81
|
+
'editor.fontSize': 10
|
|
82
|
+
}
|
|
83
|
+
}])
|
|
84
|
+
|
|
85
|
+
updateUserConfiguration(`{
|
|
86
|
+
"editor.fontSize": 12,
|
|
87
|
+
"[java]": {
|
|
88
|
+
"editor.fontSize": 15,
|
|
89
|
+
}
|
|
90
|
+
}`)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Note: using `vscode/service-override/modelEditor`, you'll be able to use the `vscode.workspace.registerTextDocumentContentProvider` api
|
|
94
|
+
|
|
95
|
+
### Troubleshoot
|
|
96
|
+
|
|
97
|
+
`StandaloneServices.initialize` can only be called once (note that `monaco.editor.create` calls `StandaloneServices.initialize`).
|
|
98
|
+
|
|
99
|
+
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.
|
|
100
|
+
|
|
101
|
+
## Editor configuration
|
|
102
|
+
|
|
103
|
+
The editors created using `monaco.editor.create` don't use the configuration from the configurationService.
|
|
104
|
+
|
|
105
|
+
This library exposes functions to create editors binded on the configuration:
|
|
106
|
+
|
|
107
|
+
before:
|
|
108
|
+
```typescript
|
|
109
|
+
import * as monaco from 'monaco-editor'
|
|
110
|
+
monaco.editor.create(...)
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
after:
|
|
114
|
+
```typescript
|
|
115
|
+
import { createConfiguredEditor } from 'vscode/monaco'
|
|
116
|
+
|
|
117
|
+
createConfiguredEditor(...)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
`createConfiguredEditor` returns a subclass of what is returned by `monaco.editor.create`, the `updateOptions` method can still be used.
|
|
121
|
+
The only difference is that is will use the `configurationService` as a default configuration
|
|
27
122
|
|
|
28
123
|
### Installation
|
|
29
124
|
|
|
@@ -39,7 +134,7 @@ Just import it as if you were in a vscode extension:
|
|
|
39
134
|
```typescript
|
|
40
135
|
import * as vscode from 'vscode'
|
|
41
136
|
|
|
42
|
-
const range = new
|
|
137
|
+
const range = new vscode.Range(...)
|
|
43
138
|
vscode.languages.registerCompletionItemProvider(...)
|
|
44
139
|
```
|
|
45
140
|
|