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

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';
@@ -45,6 +45,7 @@ function handleExtensionPoint(extensionPoint, availableExtensions, messageHandle
45
45
  extensionPoint.acceptUsers(users);
46
46
  }
47
47
  async function deltaExtensions(toAdd, toRemove) {
48
+ console.log('deltaExtensions', toAdd, toRemove)
48
49
  const affectedExtensions = [].concat(toAdd).concat(toRemove);
49
50
  const affectedExtensionPoints = Object.create(null);
50
51
  for (const extensionDescription of affectedExtensions) {
@@ -71,6 +72,31 @@ async function deltaExtensions(toAdd, toRemove) {
71
72
  }
72
73
  }
73
74
  }
75
+ let deltaExtensionPromise = Promise.resolve();
76
+ function deltaExtensionsSequential(toAdd, toRemove) {
77
+ console.log('deltaExtensionsSequential', toAdd, toRemove)
78
+ async function call() {
79
+ await deltaExtensions(toAdd, toRemove);
80
+ }
81
+ deltaExtensionPromise = deltaExtensionPromise.then(call, call);
82
+ }
83
+ let toAdd = [];
84
+ let toRemove = [];
85
+ let deltaExtensionTimeout;
86
+ function deltaExtensionsDebounced(_toAdd, _toRemove) {
87
+ console.log('deltaExtensionsDebounced', _toAdd, _toRemove)
88
+ toAdd.push(..._toAdd);
89
+ toRemove.push(..._toRemove);
90
+ if (deltaExtensionTimeout != null) {
91
+ window.clearTimeout(deltaExtensionTimeout);
92
+ }
93
+ deltaExtensionTimeout = window.setTimeout(() => {
94
+ deltaExtensionTimeout = undefined;
95
+ deltaExtensionsSequential(toAdd, toRemove);
96
+ toAdd = [];
97
+ toRemove = [];
98
+ }, 0);
99
+ }
74
100
  const extensionFileBlobUrls = new Map();
75
101
  function registerExtensionFileBlob(extensionLocation, filePath, content, mimeType) {
76
102
  const blob = new Blob([content instanceof Uint8Array ? content : new TextEncoder().encode(content)], {
@@ -103,7 +129,7 @@ function registerExtension(manifest, defaultNLS) {
103
129
  validations: []
104
130
  };
105
131
  const extensionDescription = toExtensionDescription(extension);
106
- void deltaExtensions([extensionDescription], []);
132
+ void deltaExtensionsDebounced([extensionDescription], []);
107
133
  const api = createApi(extensionDescription);
108
134
  return {
109
135
  api,
@@ -115,7 +141,7 @@ function registerExtension(manifest, defaultNLS) {
115
141
  return registerExtensionFile(location, path, async () => content);
116
142
  },
117
143
  dispose() {
118
- void deltaExtensions([], [extensionDescription]);
144
+ void deltaExtensionsDebounced([], [extensionDescription]);
119
145
  }
120
146
  };
121
147
  }
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.1",
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 );