@codingame/monaco-vscode-api 1.80.0-next.0 → 1.80.0-next.2

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.
@@ -1,5 +1,5 @@
1
1
  import { ExtensionsRegistry, ExtensionMessageCollector } from './vscode/vs/workbench/services/extensions/common/extensionsRegistry.js';
2
- import { IExtensionService, toExtensionDescription } from './vscode/vs/workbench/services/extensions/common/extensions.js';
2
+ import { toExtensionDescription, IExtensionService } from './vscode/vs/workbench/services/extensions/common/extensions.js';
3
3
  import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
4
4
  import { StandaloneServices } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js';
5
5
  import { getExtensionId } from './vscode/vs/platform/extensionManagement/common/extensionManagementUtil.js';
@@ -71,6 +71,29 @@ async function deltaExtensions(toAdd, toRemove) {
71
71
  }
72
72
  }
73
73
  }
74
+ let deltaExtensionPromise = Promise.resolve();
75
+ function deltaExtensionsSequential(toAdd, toRemove) {
76
+ async function call() {
77
+ await deltaExtensions(toAdd, toRemove);
78
+ }
79
+ deltaExtensionPromise = deltaExtensionPromise.then(call, call);
80
+ }
81
+ let toAdd = [];
82
+ let toRemove = [];
83
+ let deltaExtensionTimeout;
84
+ function deltaExtensionsDebounced(_toAdd, _toRemove) {
85
+ toAdd.push(..._toAdd);
86
+ toRemove.push(..._toRemove);
87
+ if (deltaExtensionTimeout != null) {
88
+ window.clearTimeout(deltaExtensionTimeout);
89
+ }
90
+ deltaExtensionTimeout = window.setTimeout(() => {
91
+ deltaExtensionTimeout = undefined;
92
+ deltaExtensionsSequential(toAdd, toRemove);
93
+ toAdd = [];
94
+ toRemove = [];
95
+ }, 0);
96
+ }
74
97
  const extensionFileBlobUrls = new Map();
75
98
  function registerExtensionFileBlob(extensionLocation, filePath, content, mimeType) {
76
99
  const blob = new Blob([content instanceof Uint8Array ? content : new TextEncoder().encode(content)], {
@@ -103,7 +126,7 @@ function registerExtension(manifest, defaultNLS) {
103
126
  validations: []
104
127
  };
105
128
  const extensionDescription = toExtensionDescription(extension);
106
- void deltaExtensions([extensionDescription], []);
129
+ void deltaExtensionsDebounced([extensionDescription], []);
107
130
  const api = createApi(extensionDescription);
108
131
  return {
109
132
  api,
@@ -115,7 +138,7 @@ function registerExtension(manifest, defaultNLS) {
115
138
  return registerExtensionFile(location, path, async () => content);
116
139
  },
117
140
  dispose() {
118
- void deltaExtensions([], [extensionDescription]);
141
+ void deltaExtensionsDebounced([], [extensionDescription]);
119
142
  }
120
143
  };
121
144
  }
package/dist/monaco.js CHANGED
@@ -39,7 +39,6 @@ import { createInjectedClass } from './tools/injection.js';
39
39
  import './vscode/vs/workbench/contrib/codeEditor/browser/workbenchReferenceSearch.js';
40
40
  import './vscode/vs/workbench/contrib/codeEditor/browser/menuPreventer.js';
41
41
  import './vscode/vs/workbench/contrib/codeEditor/browser/diffEditorHelper.js';
42
- import './vscode/vs/workbench/contrib/codeEditor/browser/editorFeatures.js';
43
42
  import './vscode/vs/workbench/contrib/codeEditor/browser/largeFileOptimizations.js';
44
43
  import './vscode/vs/workbench/contrib/codeEditor/browser/inspectEditorTokens/inspectEditorTokens.js';
45
44
  import './vscode/vs/workbench/contrib/codeEditor/browser/saveParticipants.js';
@@ -121,12 +121,7 @@ function plugin({ include = '**/*.vsix', exclude, rollupPlugins = [], transformM
121
121
  const extensionResources = (await extractResourcesFromExtensionManifest(manifest, async (path) => {
122
122
  return files[getVsixPath(path)];
123
123
  })).filter(resource => getVsixPath(resource.path) in files);
124
- const vsixFile = Object.keys(files).reduce((acc, usedFile) => {
125
- return ({
126
- ...acc,
127
- [usedFile]: files[getVsixPath(usedFile)]
128
- });
129
- }, {});
124
+ const vsixFile = Object.fromEntries(Object.entries(files).map(([key, value]) => [getVsixPath(key), value]));
130
125
  vsixFiles[id] = vsixFile;
131
126
  const syncPaths = extensionResources.filter(resource => resource.sync).map(r => r.path);
132
127
  const asyncPaths = Array.from(new Set([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-api",
3
- "version": "1.80.0-next.0",
3
+ "version": "1.80.0-next.2",
4
4
  "private": false,
5
5
  "description": "VSCode public API plugged on the monaco editor",
6
6
  "keywords": [],
@@ -1,44 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../node_modules/tslib/tslib.es6.js';
2
- import { onUnexpectedError } from 'monaco-editor/esm/vs/base/common/errors.js';
3
- import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
4
- import { ICodeEditorService } from 'monaco-editor/esm/vs/editor/browser/services/codeEditorService.js';
5
- import { getEditorFeatures } from 'monaco-editor/esm/vs/editor/common/editorFeatures.js';
6
- import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
7
- import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
8
- import { Extensions } from '../../../common/contributions.js';
9
- let EditorFeaturesInstantiator = class EditorFeaturesInstantiator extends Disposable {
10
- constructor(codeEditorService, _instantiationService) {
11
- super();
12
- this._instantiationService = _instantiationService;
13
- this._instantiated = false;
14
- this._register(codeEditorService.onWillCreateCodeEditor(() => this._instantiate()));
15
- this._register(codeEditorService.onWillCreateDiffEditor(() => this._instantiate()));
16
- if (codeEditorService.listCodeEditors().length > 0 || codeEditorService.listDiffEditors().length > 0) {
17
- this._instantiate();
18
- }
19
- }
20
- _instantiate() {
21
- if (this._instantiated) {
22
- return;
23
- }
24
- this._instantiated = true;
25
- const editorFeatures = getEditorFeatures();
26
- for (const feature of editorFeatures) {
27
- try {
28
- const instance = this._instantiationService.createInstance(feature);
29
- if (typeof instance.dispose === 'function') {
30
- this._register(instance);
31
- }
32
- }
33
- catch (err) {
34
- onUnexpectedError(err);
35
- }
36
- }
37
- }
38
- };
39
- EditorFeaturesInstantiator = ( __decorate([
40
- ( __param(0, ICodeEditorService)),
41
- ( __param(1, IInstantiationService))
42
- ], EditorFeaturesInstantiator));
43
- const workbenchRegistry = ( Registry.as(Extensions.Workbench));
44
- workbenchRegistry.registerWorkbenchContribution(EditorFeaturesInstantiator, 2 );