Skip to content

Commit 0f6ed46

Browse files
authored
Merge pull request #20 from CodinGame/service-override
Service override (notification, dialog, model, editor)
2 parents ea90731 + a31f879 commit 0f6ed46

16 files changed

Lines changed: 2649 additions & 358 deletions

File tree

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ This library allows you to use a more convenient way using `StandaloneService.in
3535
Also, monaco-editor doesn't provide good type for them, so this library does it.
3636

3737
Example:
38-
```
38+
```typescript
3939
import { StandaloneService, INotificationService } from 'vscode/services'
4040

4141
class MyCustomNotificationService implements INotificationService { ... }
@@ -46,6 +46,27 @@ StandaloneService.initialize({
4646
})
4747
```
4848

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+
4970
### Installation
5071

5172
```bash

0 commit comments

Comments
 (0)