@codingame/monaco-vscode-api 1.67.8-dev.0 → 1.67.10

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 CHANGED
@@ -30,19 +30,43 @@ Services.install({
30
30
 
31
31
  Also, monaco-editor use `standalone` versions or the vscode services, which are much simpler.
32
32
 
33
- You may want to provide your custom implementations of them, especially for: `textModelService`, `codeEditorService` and `notificationService`. Do do so, you can give them as the third parameter while creating your first editor.
33
+ 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.
34
34
  This library allows you to use a more convenient way using `StandaloneService.initialize`.
35
35
  Also, monaco-editor doesn't provide good type for them, so this library does it.
36
36
 
37
37
  Example:
38
- ```
38
+ ```typescript
39
39
  import { StandaloneService, INotificationService } from 'vscode/services'
40
40
 
41
+ class MyCustomNotificationService implements INotificationService { ... }
41
42
  StandaloneService.initialize({
42
- textModelService: class MyCustomNotificationService implements INotificationService { ... }
43
+ get [INotificationService.toString()] () {
44
+ return new MyCustomNotificationService(...)
45
+ }
43
46
  })
44
47
  ```
45
48
 
49
+ Additionally, this library exposes 2 modules that include the vscode version of some services (with some glue to make it work with monaco):
50
+ - Notification / Dialog: `vscode/service-override/messages`
51
+ - Model / Editor: `vscode/service-override/modelEditor`
52
+
53
+ Usage:
54
+ ```typescript
55
+ import { StandaloneService } from 'vscode/services'
56
+ import getModelEditorServiceOverride from 'vscode/service-override/modelEditor'
57
+ import getMessageServiceOverride from 'vscode/service-override/messages'
58
+
59
+ StandaloneServices.initialize({
60
+ ...getModelEditorServiceOverride((model, input, sideBySide) => {
61
+ // Open a new editor here and return it
62
+ // It will be called when for instance the user ctrl+click on an import
63
+ }),
64
+ ...getMessageServiceOverride(document.body)
65
+ })
66
+ ```
67
+
68
+ Note: using `vscode/service-override/modelEditor`, you'll be able to use the `vscode.workspace.registerTextDocumentContentProvider` api
69
+
46
70
  ### Installation
47
71
 
48
72
  ```bash