@codingame/monaco-vscode-api 1.69.21 → 1.69.23
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 +14 -2
- package/dist/dialogs.js +899 -5
- package/dist/keybindings.js +1 -1
- package/dist/layout.js +8 -898
- package/dist/missing-services.js +3 -4
- package/dist/notifications.js +6 -7
- package/dist/services2.js +1 -1
- package/dist/tools.js +2 -2
- package/dist/workspace.js +5 -5
- package/package.json +12 -11
package/README.md
CHANGED
|
@@ -10,8 +10,8 @@ The VSCode api is composed of:
|
|
|
10
10
|
- If it's an important feature: we let the user implement it as they wish.
|
|
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
|
-
|
|
14
13
|
To implement by hands the optional features (file system, workspace folders, file...), you can use the `Services` namespace from `vscode/services`:
|
|
14
|
+
|
|
15
15
|
```typescript
|
|
16
16
|
import { Services } from 'vscode/services'
|
|
17
17
|
Services.install({
|
|
@@ -37,6 +37,7 @@ This library allows you to use a more convenient way using `StandaloneServices.i
|
|
|
37
37
|
Also, monaco-editor doesn't provide good type for them, so this library does it.
|
|
38
38
|
|
|
39
39
|
Example:
|
|
40
|
+
|
|
40
41
|
```typescript
|
|
41
42
|
import { StandaloneServices, INotificationService } from 'vscode/services'
|
|
42
43
|
|
|
@@ -49,6 +50,7 @@ StandaloneServices.initialize({
|
|
|
49
50
|
```
|
|
50
51
|
|
|
51
52
|
Additionally, this library exposes 10 modules that include the vscode version of some services (with some glue to make it work with monaco):
|
|
53
|
+
|
|
52
54
|
- Notifications: `vscode/service-override/notifications`
|
|
53
55
|
- Dialogs: `vscode/service-override/dialogs`
|
|
54
56
|
- Model / Editor: `vscode/service-override/modelEditor`
|
|
@@ -62,6 +64,7 @@ Additionally, this library exposes 10 modules that include the vscode version of
|
|
|
62
64
|
- Token classification: `vscode/service-override/tokenClassification`
|
|
63
65
|
|
|
64
66
|
Usage:
|
|
67
|
+
|
|
65
68
|
```typescript
|
|
66
69
|
import { StandaloneServices } from 'vscode/services'
|
|
67
70
|
import getModelEditorServiceOverride from 'vscode/service-override/modelEditor'
|
|
@@ -106,12 +109,14 @@ The editors created using `monaco.editor.create` don't use the configuration fro
|
|
|
106
109
|
This library exposes functions to create editors binded on the configuration:
|
|
107
110
|
|
|
108
111
|
before:
|
|
112
|
+
|
|
109
113
|
```typescript
|
|
110
114
|
import * as monaco from 'monaco-editor'
|
|
111
115
|
monaco.editor.create(...)
|
|
112
116
|
```
|
|
113
117
|
|
|
114
118
|
after:
|
|
119
|
+
|
|
115
120
|
```typescript
|
|
116
121
|
import { createConfiguredEditor } from 'vscode/monaco'
|
|
117
122
|
|
|
@@ -143,6 +148,7 @@ vscode.languages.registerCompletionItemProvider(...)
|
|
|
143
148
|
|
|
144
149
|
There is a demo that showcases the service-override features. It allows to register contributions with the same syntaxes as in VSCode.
|
|
145
150
|
It includes:
|
|
151
|
+
|
|
146
152
|
- Languages
|
|
147
153
|
- Language configurations
|
|
148
154
|
- VSCode themes
|
|
@@ -157,10 +163,13 @@ It includes:
|
|
|
157
163
|
It also uses the `getJsonSchemas` function to register them on the monaco json worker and have autocomplete/hover on settings and keybindings.
|
|
158
164
|
|
|
159
165
|
From CLI run:
|
|
166
|
+
|
|
160
167
|
```bash
|
|
161
168
|
cd demo
|
|
162
169
|
npm ci
|
|
163
|
-
npm start
|
|
170
|
+
npm run start
|
|
171
|
+
# OR: for vite debug output
|
|
172
|
+
npm run start:debug
|
|
164
173
|
```
|
|
165
174
|
|
|
166
175
|
### History
|
|
@@ -170,17 +179,20 @@ This project was mainly created to make the implementation of [monaco-languagecl
|
|
|
170
179
|
monaco-languageclient uses [vscode-languageclient](https://www.npmjs.com/package/vscode-languageclient) which was built to run inside a VSCode extension. VSCode extensions communicate with the editor via an [API](https://www.npmjs.com/package/@types/vscode) they can import into their code.
|
|
171
180
|
|
|
172
181
|
[The VSCode api](https://code.visualstudio.com/api/references/vscode-api) exports:
|
|
182
|
+
|
|
173
183
|
- Some functions to interact with the IDE ([language feature registrations](https://code.visualstudio.com/api/references/vscode-api#languages), [command execution](https://code.visualstudio.com/api/references/vscode-api#commands)...)
|
|
174
184
|
- A lot of utility classes (Range, Position...)
|
|
175
185
|
|
|
176
186
|
The first implementations of [monaco-languageclient](https://github.com/TypeFox/monaco-languageclient) were using a fake VSCode api implementation. The vscode-languageclient was hacked so the VSCode<->protocol object converters were mainly bypassed, so the fake VSCode api was receiving [Language Server Protocol](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/) objects. Then the objects were transformed using custom transformers into [Monaco](https://www.npmjs.com/package/monaco-editor) objects to communicate with the monaco api.
|
|
177
187
|
|
|
178
188
|
This approach has some disadvantages:
|
|
189
|
+
|
|
179
190
|
- There is a lot of code to transform LSP objects into Monaco objects
|
|
180
191
|
- It's hard to follow the updates of VSCode and the language server protocol
|
|
181
192
|
- It doesn't behave exactly the same as in VSCode
|
|
182
193
|
|
|
183
194
|
With this library, it would be possible to plug vscode-languageclient directly on top of monaco, monaco-languageclient still helps to do so by:
|
|
195
|
+
|
|
184
196
|
- Adding some tweaks to the VSCode LanguageClient (Removing unsupported features...)
|
|
185
197
|
- Providing a default implementations of the required fallback services (`vscode/services`)
|
|
186
198
|
- Providing some examples on how to build an app using it
|