@codingame/monaco-vscode-api 3.2.2 → 3.2.3
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 +22 -17
- package/missing-services.js +7 -7
- package/package.json +8 -8
- package/services.js +4 -4
package/README.md
CHANGED
|
@@ -29,9 +29,10 @@ Make sure `typeof process === 'undefined'` returns true when using this library.
|
|
|
29
29
|
Starting from v2, [monaco-editor-webpack-plugin](https://www.npmjs.com/package/monaco-editor-webpack-plugin) can't be used
|
|
30
30
|
|
|
31
31
|
Here's the alternative for each options:
|
|
32
|
+
|
|
32
33
|
- `filename`: it can be configured at the webpack level directly
|
|
33
34
|
- `publicPath`: it can be configured at the webpack level or by hands when redistering the worker in `window.MonacoEnvironment`.
|
|
34
|
-
- `languages`:
|
|
35
|
+
- `languages`: Import vscode language extensions (`@codingame/monaco-vscode-xxx-default-extension`) or (`@codingame/@codingame/monaco-vscode-standalone-*`). Please obey: VSCode extensions can only be used if `themes` and `textmate` service overrides are configured and monaco languages can only be used if those two services are not configured (see [here](#monaco-standalone-services) for further details).
|
|
35
36
|
- `features`: With this lib, you can't remove editor features.
|
|
36
37
|
- `globalAPI`: you can set `window.MonacoEnvironment.globalAPI` to true
|
|
37
38
|
|
|
@@ -40,12 +41,14 @@ Here's the alternative for each options:
|
|
|
40
41
|
This library uses a lot the `new URL('asset.extension', import.meta.url)` syntax which [is supported by vite](https://vitejs.dev/guide/assets.html#new-url-url-import-meta-url)
|
|
41
42
|
|
|
42
43
|
While it works great in `build` mode (because rollup is used), there is some issues in `watch` mode:
|
|
44
|
+
|
|
43
45
|
- import.meta.url is not replaced while creating bundles, it is an issue when the syntax is used inside a dependency
|
|
44
46
|
- vite is still trying to inject/transform javascript assets files, breaking the code by injecting ESM imports in commonjs files
|
|
45
47
|
|
|
46
48
|
There are workarounds for both:
|
|
47
49
|
|
|
48
50
|
- We can help vite by replacing `import.meta.url` by the original module path:
|
|
51
|
+
|
|
49
52
|
```typescript
|
|
50
53
|
import importMetaUrlPlugin from '@codingame/esbuild-import-meta-url-plugin'
|
|
51
54
|
|
|
@@ -62,12 +65,13 @@ import importMetaUrlPlugin from '@codingame/esbuild-import-meta-url-plugin'
|
|
|
62
65
|
### If using Angular and getting `Not allowed to load local resource:` errors
|
|
63
66
|
|
|
64
67
|
*The short version*: set up and use a custom webpack config file and add this under `module`:
|
|
68
|
+
|
|
65
69
|
```typescript
|
|
66
70
|
parser: {
|
|
67
71
|
javascript: {
|
|
68
72
|
url: true,
|
|
69
|
-
}
|
|
70
|
-
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
71
75
|
```
|
|
72
76
|
|
|
73
77
|
See [this issue](https://github.com/CodinGame/monaco-vscode-api/issues/186) or this [StackOverflow answer](https://stackoverflow.com/a/75252098) for more details, and [this discussion](https://github.com/angular/angular-cli/issues/24617) for more context.
|
|
@@ -77,16 +81,17 @@ See [this issue](https://github.com/CodinGame/monaco-vscode-api/issues/186) or t
|
|
|
77
81
|
The typescript language features extensions requires [SharedArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) to enable project wide intellisense or only a per-file intellisense is provided.
|
|
78
82
|
|
|
79
83
|
It requires [crossOriginIsolated](https://developer.mozilla.org/en-US/docs/Web/API/crossOriginIsolated) to be true, which requires assets files to be servers with some specific headers:
|
|
84
|
+
|
|
80
85
|
- [Cross-Origin-Opener-Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Opener-Policy): `same-origin`
|
|
81
86
|
- [Cross-Origin-Embedder-Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Embedder-Policy): `require-corp` or `credentialless`
|
|
82
87
|
|
|
83
88
|
At least thoses files should have the headers:
|
|
89
|
+
|
|
84
90
|
- the main page html
|
|
85
91
|
- the worker extension host iframe html: `webWorkerExtensionHostIframe.html`
|
|
86
92
|
- the worker extension host worker javascript: `extensionHost.worker.js`
|
|
87
93
|
|
|
88
|
-
If adding those headers is not an options, you can have a look at https://github.com/gzuidhof/coi-serviceworker
|
|
89
|
-
|
|
94
|
+
If adding those headers is not an options, you can have a look at <https://github.com/gzuidhof/coi-serviceworker>, but only if you are not using webviews as it introduces problems then.
|
|
90
95
|
|
|
91
96
|
# Usage
|
|
92
97
|
|
|
@@ -220,7 +225,7 @@ Additionally, several packages that include the VSCode version of some services
|
|
|
220
225
|
- **Issue**
|
|
221
226
|
- Issue reporting
|
|
222
227
|
- **Multi diff editor**
|
|
223
|
-
- Multi diff editor support (https://code.visualstudio.com/updates/v1_85#_multifile-diff-editor)
|
|
228
|
+
- Multi diff editor support (<https://code.visualstudio.com/updates/v1_85#_multifile-diff-editor>)
|
|
224
229
|
- **Performance**
|
|
225
230
|
- Performance monitoring
|
|
226
231
|
- **Relauncher**
|
|
@@ -269,6 +274,7 @@ This method creates a standalone model that cannot be found or used by any VSCod
|
|
|
269
274
|
The recommended way is to used the `createModelReference` method instead (added on top of the official monaco-editor api) which returns instead a reference to a model.
|
|
270
275
|
|
|
271
276
|
It has some pros:
|
|
277
|
+
|
|
272
278
|
- The model reference can be used by VSCode services, allowing for instance following links between files (ctrl+click)
|
|
273
279
|
- The returned model is bound to a filesystem file, and you have access to methods allowing to control the file lifecycle (saving the file, accessing the dirty state...)
|
|
274
280
|
- It is possible to call the method multiple times on the same file to get multiple references. The model is disposed when there is no reference left
|
|
@@ -328,6 +334,7 @@ vscode.languages.registerCompletionItemProvider(...)
|
|
|
328
334
|
```
|
|
329
335
|
|
|
330
336
|
You can also register a new extension from its manifest:
|
|
337
|
+
|
|
331
338
|
```typescript
|
|
332
339
|
import { registerExtension, initialize, ExtensionHostKind } from 'vscode/extensions'
|
|
333
340
|
|
|
@@ -354,9 +361,10 @@ vscode.languages.registerCompletionItemProvider(...)
|
|
|
354
361
|
|
|
355
362
|
### Default vscode extensions
|
|
356
363
|
|
|
357
|
-
VSCode uses a bunch of default extensions. Most of them are used to load the default languages and grammars (see
|
|
364
|
+
VSCode uses a bunch of default extensions. Most of them are used to load the default languages and grammars (see <ttps://github.com/microsoft/vscode/tree/main/extensions>).
|
|
358
365
|
|
|
359
366
|
This library bundles and publishes them and allows to import the ones you want:
|
|
367
|
+
|
|
360
368
|
```typescript
|
|
361
369
|
import '@codingame/monaco-vscode-javascript-default-extension'
|
|
362
370
|
import '@codingame/monaco-vscode-json-default-extension'
|
|
@@ -369,6 +377,7 @@ VSCode extensions are bundled as vsix files.
|
|
|
369
377
|
This library publishes a rollup plugin (vite-compatible) that allows to load a vsix file.
|
|
370
378
|
|
|
371
379
|
- rollup/vite config:
|
|
380
|
+
|
|
372
381
|
```typescript
|
|
373
382
|
import vsixPlugin from '@codingame/monaco-vscode-rollup-vsix-plugin'
|
|
374
383
|
...
|
|
@@ -377,7 +386,9 @@ plugins: [
|
|
|
377
386
|
vsixPlugin()
|
|
378
387
|
]
|
|
379
388
|
```
|
|
389
|
+
|
|
380
390
|
- code:
|
|
391
|
+
|
|
381
392
|
```typescript
|
|
382
393
|
import './extension.vsix'
|
|
383
394
|
```
|
|
@@ -385,6 +396,7 @@ import './extension.vsix'
|
|
|
385
396
|
### Localization
|
|
386
397
|
|
|
387
398
|
This library also offers the possibility to localize vscode and the extensions in the supported languages. To do so, import one of the following packages before anything else:
|
|
399
|
+
|
|
388
400
|
- `@codingame/monaco-vscode-language-pack-cs`
|
|
389
401
|
- `@codingame/monaco-vscode-language-pack-de`
|
|
390
402
|
- `@codingame/monaco-vscode-language-pack-es`
|
|
@@ -402,10 +414,9 @@ This library also offers the possibility to localize vscode and the extensions i
|
|
|
402
414
|
|
|
403
415
|
⚠️ The language pack should be imported and loaded BEFORE anything else from monaco-editor or this library is loaded. Otherwise, some translations would be missing. ⚠️
|
|
404
416
|
|
|
405
|
-
|
|
406
417
|
### Demo
|
|
407
418
|
|
|
408
|
-
Try it out on https://monaco-vscode-api.netlify.app
|
|
419
|
+
Try it out on <https://monaco-vscode-api.netlify.app/>
|
|
409
420
|
|
|
410
421
|
There is a demo that showcases the service-override features. It allows to register contributions with the same syntaxes as in VSCode.
|
|
411
422
|
It includes:
|
|
@@ -436,6 +447,7 @@ npm run start:debug
|
|
|
436
447
|
```
|
|
437
448
|
|
|
438
449
|
For the debug feature, also run:
|
|
450
|
+
|
|
439
451
|
```bash
|
|
440
452
|
npm run start:debugServer
|
|
441
453
|
```
|
|
@@ -444,14 +456,7 @@ npm run start:debugServer
|
|
|
444
456
|
|
|
445
457
|
#### Remote agent
|
|
446
458
|
|
|
447
|
-
|
|
448
|
-
```bash
|
|
449
|
-
npm run start:extHostServer
|
|
450
|
-
```
|
|
451
|
-
|
|
452
|
-
Then go to http://localhost:5173/?remoteAuthority=localhost:8000
|
|
453
|
-
|
|
454
|
-
You can also go to http://localhost:5173/?remoteAuthority=localhost:8000&remotePath=/any/path/on/your/machine to open a directory on your machine as the current workspace
|
|
459
|
+
[See vscode_server.md](./docs/vscode_server.md)
|
|
455
460
|
|
|
456
461
|
### History
|
|
457
462
|
|
package/missing-services.js
CHANGED
|
@@ -31,7 +31,7 @@ import { IUserDataProfileService, IUserDataProfileImportExportService, IUserData
|
|
|
31
31
|
import { UserDataProfileService } from './vscode/src/vs/workbench/services/userDataProfile/common/userDataProfileService.js';
|
|
32
32
|
import { ISnippetsService } from './vscode/src/vs/workbench/contrib/snippets/browser/snippets.js';
|
|
33
33
|
import { AbstractLoggerService, LogLevel, NullLogger, ILoggerService } from './vscode/src/vs/platform/log/common/log.js';
|
|
34
|
-
import { Disposable
|
|
34
|
+
import { Disposable } from './vscode/src/vs/base/common/lifecycle.js';
|
|
35
35
|
import { FallbackKeyboardMapper } from './vscode/src/vs/workbench/services/keybinding/common/fallbackKeyboardMapper.js';
|
|
36
36
|
import { ITextMateTokenizationService } from './vscode/src/vs/workbench/services/textMate/browser/textMateTokenizationFeature.js';
|
|
37
37
|
import { IDebugService } from './vscode/src/vs/workbench/contrib/debug/common/debug.js';
|
|
@@ -558,7 +558,7 @@ registerSingleton(IProductService, class ProductService {
|
|
|
558
558
|
constructor() {
|
|
559
559
|
this._serviceBrand = undefined;
|
|
560
560
|
this.version = "1.87.2";
|
|
561
|
-
this.commit = "
|
|
561
|
+
this.commit = "863d2581ecda6849923a2118d93a088b0745d9d6";
|
|
562
562
|
this.quality = 'oss';
|
|
563
563
|
this.nameShort = 'Code - OSS Dev';
|
|
564
564
|
this.nameLong = 'Code - OSS Dev';
|
|
@@ -1033,11 +1033,11 @@ MonacoSearchService = __decorate([
|
|
|
1033
1033
|
registerSingleton(ISearchService, MonacoSearchService, 0 );
|
|
1034
1034
|
registerSingleton(IEditSessionIdentityService, class EditSessionIdentityService {
|
|
1035
1035
|
constructor() {
|
|
1036
|
-
this.registerEditSessionIdentityProvider =
|
|
1037
|
-
this.getEditSessionIdentifier =
|
|
1038
|
-
this.provideEditSessionIdentityMatch =
|
|
1039
|
-
this.addEditSessionIdentityCreateParticipant = () =>
|
|
1040
|
-
this.onWillCreateEditSessionIdentity =
|
|
1036
|
+
this.registerEditSessionIdentityProvider = () => Disposable.None;
|
|
1037
|
+
this.getEditSessionIdentifier = async () => undefined;
|
|
1038
|
+
this.provideEditSessionIdentityMatch = async () => undefined;
|
|
1039
|
+
this.addEditSessionIdentityCreateParticipant = () => Disposable.None;
|
|
1040
|
+
this.onWillCreateEditSessionIdentity = async () => { };
|
|
1041
1041
|
}
|
|
1042
1042
|
}, 0 );
|
|
1043
1043
|
registerSingleton(IWorkspaceEditingService, class WorkspaceEditingService {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-api",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.3",
|
|
4
4
|
"description": "VSCode public API plugged on the monaco editor",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": {
|
|
@@ -94,12 +94,12 @@
|
|
|
94
94
|
}
|
|
95
95
|
},
|
|
96
96
|
"dependencies": {
|
|
97
|
-
"@codingame/monaco-vscode-
|
|
98
|
-
"@codingame/monaco-vscode-
|
|
99
|
-
"@codingame/monaco-vscode-
|
|
100
|
-
"@codingame/monaco-vscode-environment-service-override": "3.2.
|
|
101
|
-
"@codingame/monaco-vscode-layout-service-override": "3.2.
|
|
102
|
-
"@codingame/monaco-vscode-host-service-override": "3.2.
|
|
103
|
-
"@codingame/monaco-vscode-base-service-override": "3.2.
|
|
97
|
+
"@codingame/monaco-vscode-files-service-override": "3.2.3",
|
|
98
|
+
"@codingame/monaco-vscode-quickaccess-service-override": "3.2.3",
|
|
99
|
+
"@codingame/monaco-vscode-extensions-service-override": "3.2.3",
|
|
100
|
+
"@codingame/monaco-vscode-environment-service-override": "3.2.3",
|
|
101
|
+
"@codingame/monaco-vscode-layout-service-override": "3.2.3",
|
|
102
|
+
"@codingame/monaco-vscode-host-service-override": "3.2.3",
|
|
103
|
+
"@codingame/monaco-vscode-base-service-override": "3.2.3"
|
|
104
104
|
}
|
|
105
105
|
}
|
package/services.js
CHANGED
|
@@ -150,10 +150,10 @@ async function initialize(overrides, container = document.body, configuration =
|
|
|
150
150
|
const instantiationService = StandaloneServices.initialize({
|
|
151
151
|
[( IProductService.toString())]: mixin({
|
|
152
152
|
version: "1.87.2",
|
|
153
|
-
quality: '
|
|
154
|
-
commit: "
|
|
155
|
-
nameShort: 'Code - OSS
|
|
156
|
-
nameLong: 'Code - OSS
|
|
153
|
+
quality: 'stable',
|
|
154
|
+
commit: "863d2581ecda6849923a2118d93a088b0745d9d6",
|
|
155
|
+
nameShort: 'Code - OSS',
|
|
156
|
+
nameLong: 'Code - OSS',
|
|
157
157
|
applicationName: 'code-oss',
|
|
158
158
|
dataFolderName: '.vscode-oss',
|
|
159
159
|
urlProtocol: 'code-oss',
|