@codingame/monaco-vscode-extensions-service-override 6.0.3 → 7.0.0

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,11 +1,17 @@
1
1
  import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
2
+ import { Barrier } from 'vscode/vscode/vs/base/common/async';
2
3
  import { URI } from 'vscode/vscode/vs/base/common/uri';
3
4
  import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
5
+ import { observableValue } from 'vscode/vscode/vs/base/common/observableInternal/base';
6
+ import 'vscode/vscode/vs/base/common/observableInternal/derived';
7
+ import 'vscode/vscode/vs/base/common/observableInternal/autorun';
8
+ import 'vscode/vscode/vs/base/common/observableInternal/utils';
9
+ import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation';
10
+ import 'vscode/vscode/vs/base/common/arrays';
4
11
  import { Disposable, DisposableStore, dispose, combinedDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
5
12
  import { ISCMService, ISCMViewService } from 'vscode/vscode/vs/workbench/contrib/scm/common/scm.service';
6
13
  import { ExtHostContext, MainContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
7
14
  import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js';
8
- import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation';
9
15
  import { MarshalledId } from 'vscode/vscode/vs/base/common/marshallingIds';
10
16
  import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
11
17
  import { IQuickDiffService } from 'vscode/vscode/vs/workbench/contrib/scm/common/quickDiff.service';
@@ -17,6 +23,7 @@ import { ILanguageService } from 'vscode/vscode/vs/editor/common/languages/langu
17
23
  import { IModelService } from 'vscode/vscode/vs/editor/common/services/model';
18
24
  import { ITextModelService } from 'vscode/vscode/vs/editor/common/services/resolverService';
19
25
  import { Schemas } from 'vscode/vscode/vs/base/common/network';
26
+ import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
20
27
 
21
28
  function getIconFromIconDto(iconDto) {
22
29
  if (iconDto === undefined) {
@@ -33,6 +40,11 @@ function getIconFromIconDto(iconDto) {
33
40
  return { light: URI.revive(icon.light), dark: URI.revive(icon.dark) };
34
41
  }
35
42
  }
43
+ function toISCMHistoryItem(historyItemDto) {
44
+ const icon = getIconFromIconDto(historyItemDto.icon);
45
+ const labels = historyItemDto.labels?.map(l => ({ title: l.title, icon: getIconFromIconDto(l.icon) }));
46
+ return { ...historyItemDto, icon, labels };
47
+ }
36
48
  class SCMInputBoxContentProvider extends Disposable {
37
49
  constructor(textModelService, modelService, languageService) {
38
50
  super();
@@ -128,22 +140,28 @@ class MainThreadSCMHistoryProvider {
128
140
  this._currentHistoryItemGroup = historyItemGroup;
129
141
  this._onDidChangeCurrentHistoryItemGroup.fire();
130
142
  }
143
+ get currentHistoryItemGroupObs() { return this._currentHistoryItemGroupObs; }
131
144
  constructor(proxy, handle) {
132
145
  this.proxy = proxy;
133
146
  this.handle = handle;
134
147
  this._onDidChangeCurrentHistoryItemGroup = ( new Emitter());
135
148
  this.onDidChangeCurrentHistoryItemGroup = this._onDidChangeCurrentHistoryItemGroup.event;
149
+ this._currentHistoryItemGroupObs = observableValue(this, undefined);
136
150
  }
137
151
  async resolveHistoryItemGroupCommonAncestor(historyItemGroupId1, historyItemGroupId2) {
138
152
  return this.proxy.$resolveHistoryItemGroupCommonAncestor(this.handle, historyItemGroupId1, historyItemGroupId2, CancellationToken.None);
139
153
  }
140
154
  async provideHistoryItems(historyItemGroupId, options) {
141
155
  const historyItems = await this.proxy.$provideHistoryItems(this.handle, historyItemGroupId, options, CancellationToken.None);
142
- return historyItems?.map(historyItem => ({ ...historyItem, icon: getIconFromIconDto(historyItem.icon) }));
156
+ return historyItems?.map(historyItem => toISCMHistoryItem(historyItem));
157
+ }
158
+ async provideHistoryItems2(options) {
159
+ const historyItems = await this.proxy.$provideHistoryItems2(this.handle, options, CancellationToken.None);
160
+ return historyItems?.map(historyItem => toISCMHistoryItem(historyItem));
143
161
  }
144
162
  async provideHistoryItemSummary(historyItemId, historyItemParentId) {
145
163
  const historyItem = await this.proxy.$provideHistoryItemSummary(this.handle, historyItemId, historyItemParentId, CancellationToken.None);
146
- return historyItem ? { ...historyItem, icon: getIconFromIconDto(historyItem.icon) } : undefined;
164
+ return historyItem ? toISCMHistoryItem(historyItem) : undefined;
147
165
  }
148
166
  async provideHistoryItemChanges(historyItemId, historyItemParentId) {
149
167
  const changes = await this.proxy.$provideHistoryItemChanges(this.handle, historyItemId, historyItemParentId, CancellationToken.None);
@@ -154,6 +172,9 @@ class MainThreadSCMHistoryProvider {
154
172
  renameUri: change.renameUri && URI.revive(change.renameUri)
155
173
  }));
156
174
  }
175
+ $onDidChangeCurrentHistoryItemGroup(historyItemGroup) {
176
+ this._currentHistoryItemGroupObs.set(historyItemGroup, undefined);
177
+ }
157
178
  }
158
179
  class MainThreadSCMProvider {
159
180
  static { this.ID_HANDLE = 0; }
@@ -163,15 +184,15 @@ class MainThreadSCMProvider {
163
184
  get rootUri() { return this._rootUri; }
164
185
  get inputBoxTextModel() { return this._inputBoxTextModel; }
165
186
  get contextValue() { return this._providerId; }
166
- get commitTemplate() { return this.features.commitTemplate || ''; }
167
187
  get historyProvider() { return this._historyProvider; }
168
188
  get acceptInputCommand() { return this.features.acceptInputCommand; }
169
189
  get actionButton() { return this.features.actionButton ?? undefined; }
170
- get statusBarCommands() { return this.features.statusBarCommands; }
171
- get count() { return this.features.count; }
190
+ get count() { return this._count; }
191
+ get statusBarCommands() { return this._statusBarCommands; }
172
192
  get name() { return this._name ?? this._label; }
173
- get onDidChangeStatusBarCommands() { return this._onDidChangeStatusBarCommands.event; }
174
- constructor(proxy, _handle, _providerId, _label, _rootUri, _inputBoxTextModel, _quickDiffService, _uriIdentService, _workspaceContextService) {
193
+ get commitTemplate() { return this._commitTemplate; }
194
+ get historyProviderObs() { return this._historyProviderObs; }
195
+ constructor(proxy, _handle, _providerId, _label, _rootUri, _inputBoxTextModel, _quickDiffService, _uriIdentService, _workspaceContextService, _logService) {
175
196
  this.proxy = proxy;
176
197
  this._handle = _handle;
177
198
  this._providerId = _providerId;
@@ -181,6 +202,7 @@ class MainThreadSCMProvider {
181
202
  this._quickDiffService = _quickDiffService;
182
203
  this._uriIdentService = _uriIdentService;
183
204
  this._workspaceContextService = _workspaceContextService;
205
+ this._logService = _logService;
184
206
  this._id = `scm${MainThreadSCMProvider.ID_HANDLE++}`;
185
207
  this.groups = [];
186
208
  this._onDidChangeResourceGroups = ( new Emitter());
@@ -189,14 +211,15 @@ class MainThreadSCMProvider {
189
211
  this.onDidChangeResources = this._onDidChangeResources.event;
190
212
  this._groupsByHandle = Object.create(null);
191
213
  this.features = {};
192
- this._onDidChangeCommitTemplate = ( new Emitter());
193
- this.onDidChangeCommitTemplate = this._onDidChangeCommitTemplate.event;
194
- this._onDidChangeStatusBarCommands = ( new Emitter());
214
+ this._count = observableValue(this, undefined);
215
+ this._statusBarCommands = observableValue(this, undefined);
216
+ this._commitTemplate = observableValue(this, '');
195
217
  this._onDidChangeHistoryProvider = ( new Emitter());
196
218
  this.onDidChangeHistoryProvider = this._onDidChangeHistoryProvider.event;
197
219
  this._onDidChange = ( new Emitter());
198
220
  this.onDidChange = this._onDidChange.event;
199
221
  this.isSCM = true;
222
+ this._historyProviderObs = observableValue(this, undefined);
200
223
  if (_rootUri) {
201
224
  const folder = this._workspaceContextService.getWorkspaceFolder(_rootUri);
202
225
  if (folder?.uri.toString() === ( _rootUri.toString())) {
@@ -211,10 +234,14 @@ class MainThreadSCMProvider {
211
234
  this.features = { ...this.features, ...features };
212
235
  this._onDidChange.fire();
213
236
  if (typeof features.commitTemplate !== 'undefined') {
214
- this._onDidChangeCommitTemplate.fire(this.commitTemplate);
237
+ this._commitTemplate.set(features.commitTemplate, undefined);
238
+ }
239
+ if (typeof features.count !== 'undefined') {
240
+ this._count.set(features.count, undefined);
215
241
  }
216
242
  if (typeof features.statusBarCommands !== 'undefined') {
217
- this._onDidChangeStatusBarCommands.fire(this.statusBarCommands);
243
+ this._logService.trace(`MainThreadSCMProvider#updateSourceControl (${this._id}): ${( features.statusBarCommands.map(c => c.title)).join(', ')}`);
244
+ this._statusBarCommands.set(features.statusBarCommands, undefined);
218
245
  }
219
246
  if (features.hasQuickDiffProvider && !this._quickDiff) {
220
247
  this._quickDiff = this._quickDiffService.addQuickDiffProvider({
@@ -229,10 +256,13 @@ class MainThreadSCMProvider {
229
256
  this._quickDiff = undefined;
230
257
  }
231
258
  if (features.hasHistoryProvider && !this._historyProvider) {
232
- this._historyProvider = ( new MainThreadSCMHistoryProvider(this.proxy, this.handle));
259
+ const historyProvider = ( new MainThreadSCMHistoryProvider(this.proxy, this.handle));
260
+ this._historyProviderObs.set(historyProvider, undefined);
261
+ this._historyProvider = historyProvider;
233
262
  this._onDidChangeHistoryProvider.fire();
234
263
  }
235
264
  else if (features.hasHistoryProvider === false && this._historyProvider) {
265
+ this._historyProviderObs.set(undefined, undefined);
236
266
  this._historyProvider = undefined;
237
267
  this._onDidChangeHistoryProvider.fire();
238
268
  }
@@ -330,6 +360,7 @@ class MainThreadSCMProvider {
330
360
  return;
331
361
  }
332
362
  this._historyProvider.currentHistoryItemGroup = currentHistoryItemGroup ?? undefined;
363
+ this._historyProviderObs.get()?.$onDidChangeCurrentHistoryItemGroup(currentHistoryItemGroup);
333
364
  }
334
365
  toJSON() {
335
366
  return {
@@ -342,7 +373,7 @@ class MainThreadSCMProvider {
342
373
  }
343
374
  }
344
375
  let MainThreadSCM = class MainThreadSCM {
345
- constructor(extHostContext, scmService, scmViewService, languageService, modelService, textModelService, quickDiffService, _uriIdentService, workspaceContextService) {
376
+ constructor(extHostContext, scmService, scmViewService, languageService, modelService, textModelService, quickDiffService, _uriIdentService, workspaceContextService, logService) {
346
377
  this.scmService = scmService;
347
378
  this.scmViewService = scmViewService;
348
379
  this.languageService = languageService;
@@ -351,7 +382,9 @@ let MainThreadSCM = class MainThreadSCM {
351
382
  this.quickDiffService = quickDiffService;
352
383
  this._uriIdentService = _uriIdentService;
353
384
  this.workspaceContextService = workspaceContextService;
385
+ this.logService = logService;
354
386
  this._repositories = ( new Map());
387
+ this._repositoryBarriers = ( new Map());
355
388
  this._repositoryDisposables = ( new Map());
356
389
  this._disposables = ( new DisposableStore());
357
390
  this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostSCM));
@@ -365,6 +398,7 @@ let MainThreadSCM = class MainThreadSCM {
365
398
  this._disposables.dispose();
366
399
  }
367
400
  async $registerSourceControl(handle, id, label, rootUri, inputBoxDocumentUri) {
401
+ this._repositoryBarriers.set(handle, ( new Barrier()));
368
402
  const inputBoxTextModelRef = await this.textModelService.createModelReference(URI.revive(inputBoxDocumentUri));
369
403
  const provider = ( new MainThreadSCMProvider(
370
404
  this._proxy,
@@ -375,20 +409,23 @@ let MainThreadSCM = class MainThreadSCM {
375
409
  inputBoxTextModelRef.object.textEditorModel,
376
410
  this.quickDiffService,
377
411
  this._uriIdentService,
378
- this.workspaceContextService
412
+ this.workspaceContextService,
413
+ this.logService
379
414
  ));
380
415
  const repository = this.scmService.registerSCMProvider(provider);
381
416
  this._repositories.set(handle, repository);
382
417
  const disposable = combinedDisposable(inputBoxTextModelRef, Event.filter(this.scmViewService.onDidFocusRepository, r => r === repository)(_ => this._proxy.$setSelectedSourceControl(handle)), repository.input.onDidChange(({ value }) => this._proxy.$onInputBoxValueChange(handle, value)));
418
+ this._repositoryDisposables.set(handle, disposable);
383
419
  if (this.scmViewService.focusedRepository === repository) {
384
420
  setTimeout(() => this._proxy.$setSelectedSourceControl(handle), 0);
385
421
  }
386
422
  if (repository.input.value) {
387
423
  setTimeout(() => this._proxy.$onInputBoxValueChange(handle, repository.input.value), 0);
388
424
  }
389
- this._repositoryDisposables.set(handle, disposable);
425
+ this._repositoryBarriers.get(handle)?.open();
390
426
  }
391
- $updateSourceControl(handle, features) {
427
+ async $updateSourceControl(handle, features) {
428
+ await this._repositoryBarriers.get(handle)?.wait();
392
429
  const repository = this._repositories.get(handle);
393
430
  if (!repository) {
394
431
  return;
@@ -396,7 +433,8 @@ let MainThreadSCM = class MainThreadSCM {
396
433
  const provider = repository.provider;
397
434
  provider.$updateSourceControl(features);
398
435
  }
399
- $unregisterSourceControl(handle) {
436
+ async $unregisterSourceControl(handle) {
437
+ await this._repositoryBarriers.get(handle)?.wait();
400
438
  const repository = this._repositories.get(handle);
401
439
  if (!repository) {
402
440
  return;
@@ -406,7 +444,8 @@ let MainThreadSCM = class MainThreadSCM {
406
444
  repository.dispose();
407
445
  this._repositories.delete(handle);
408
446
  }
409
- $registerGroups(sourceControlHandle, groups, splices) {
447
+ async $registerGroups(sourceControlHandle, groups, splices) {
448
+ await this._repositoryBarriers.get(sourceControlHandle)?.wait();
410
449
  const repository = this._repositories.get(sourceControlHandle);
411
450
  if (!repository) {
412
451
  return;
@@ -415,7 +454,8 @@ let MainThreadSCM = class MainThreadSCM {
415
454
  provider.$registerGroups(groups);
416
455
  provider.$spliceGroupResourceStates(splices);
417
456
  }
418
- $updateGroup(sourceControlHandle, groupHandle, features) {
457
+ async $updateGroup(sourceControlHandle, groupHandle, features) {
458
+ await this._repositoryBarriers.get(sourceControlHandle)?.wait();
419
459
  const repository = this._repositories.get(sourceControlHandle);
420
460
  if (!repository) {
421
461
  return;
@@ -423,7 +463,8 @@ let MainThreadSCM = class MainThreadSCM {
423
463
  const provider = repository.provider;
424
464
  provider.$updateGroup(groupHandle, features);
425
465
  }
426
- $updateGroupLabel(sourceControlHandle, groupHandle, label) {
466
+ async $updateGroupLabel(sourceControlHandle, groupHandle, label) {
467
+ await this._repositoryBarriers.get(sourceControlHandle)?.wait();
427
468
  const repository = this._repositories.get(sourceControlHandle);
428
469
  if (!repository) {
429
470
  return;
@@ -431,7 +472,8 @@ let MainThreadSCM = class MainThreadSCM {
431
472
  const provider = repository.provider;
432
473
  provider.$updateGroupLabel(groupHandle, label);
433
474
  }
434
- $spliceResourceStates(sourceControlHandle, splices) {
475
+ async $spliceResourceStates(sourceControlHandle, splices) {
476
+ await this._repositoryBarriers.get(sourceControlHandle)?.wait();
435
477
  const repository = this._repositories.get(sourceControlHandle);
436
478
  if (!repository) {
437
479
  return;
@@ -439,7 +481,8 @@ let MainThreadSCM = class MainThreadSCM {
439
481
  const provider = repository.provider;
440
482
  provider.$spliceGroupResourceStates(splices);
441
483
  }
442
- $unregisterGroup(sourceControlHandle, handle) {
484
+ async $unregisterGroup(sourceControlHandle, handle) {
485
+ await this._repositoryBarriers.get(sourceControlHandle)?.wait();
443
486
  const repository = this._repositories.get(sourceControlHandle);
444
487
  if (!repository) {
445
488
  return;
@@ -447,42 +490,48 @@ let MainThreadSCM = class MainThreadSCM {
447
490
  const provider = repository.provider;
448
491
  provider.$unregisterGroup(handle);
449
492
  }
450
- $setInputBoxValue(sourceControlHandle, value) {
493
+ async $setInputBoxValue(sourceControlHandle, value) {
494
+ await this._repositoryBarriers.get(sourceControlHandle)?.wait();
451
495
  const repository = this._repositories.get(sourceControlHandle);
452
496
  if (!repository) {
453
497
  return;
454
498
  }
455
499
  repository.input.setValue(value, false);
456
500
  }
457
- $setInputBoxPlaceholder(sourceControlHandle, placeholder) {
501
+ async $setInputBoxPlaceholder(sourceControlHandle, placeholder) {
502
+ await this._repositoryBarriers.get(sourceControlHandle)?.wait();
458
503
  const repository = this._repositories.get(sourceControlHandle);
459
504
  if (!repository) {
460
505
  return;
461
506
  }
462
507
  repository.input.placeholder = placeholder;
463
508
  }
464
- $setInputBoxEnablement(sourceControlHandle, enabled) {
509
+ async $setInputBoxEnablement(sourceControlHandle, enabled) {
510
+ await this._repositoryBarriers.get(sourceControlHandle)?.wait();
465
511
  const repository = this._repositories.get(sourceControlHandle);
466
512
  if (!repository) {
467
513
  return;
468
514
  }
469
515
  repository.input.enabled = enabled;
470
516
  }
471
- $setInputBoxVisibility(sourceControlHandle, visible) {
517
+ async $setInputBoxVisibility(sourceControlHandle, visible) {
518
+ await this._repositoryBarriers.get(sourceControlHandle)?.wait();
472
519
  const repository = this._repositories.get(sourceControlHandle);
473
520
  if (!repository) {
474
521
  return;
475
522
  }
476
523
  repository.input.visible = visible;
477
524
  }
478
- $showValidationMessage(sourceControlHandle, message, type) {
525
+ async $showValidationMessage(sourceControlHandle, message, type) {
526
+ await this._repositoryBarriers.get(sourceControlHandle)?.wait();
479
527
  const repository = this._repositories.get(sourceControlHandle);
480
528
  if (!repository) {
481
529
  return;
482
530
  }
483
531
  repository.input.showValidationMessage(message, type);
484
532
  }
485
- $setValidationProviderIsEnabled(sourceControlHandle, enabled) {
533
+ async $setValidationProviderIsEnabled(sourceControlHandle, enabled) {
534
+ await this._repositoryBarriers.get(sourceControlHandle)?.wait();
486
535
  const repository = this._repositories.get(sourceControlHandle);
487
536
  if (!repository) {
488
537
  return;
@@ -497,7 +546,8 @@ let MainThreadSCM = class MainThreadSCM {
497
546
  repository.input.validateInput = async () => undefined;
498
547
  }
499
548
  }
500
- $onDidChangeHistoryProviderCurrentHistoryItemGroup(sourceControlHandle, historyItemGroup) {
549
+ async $onDidChangeHistoryProviderCurrentHistoryItemGroup(sourceControlHandle, historyItemGroup) {
550
+ await this._repositoryBarriers.get(sourceControlHandle)?.wait();
501
551
  const repository = this._repositories.get(sourceControlHandle);
502
552
  if (!repository) {
503
553
  return;
@@ -515,7 +565,8 @@ MainThreadSCM = __decorate([
515
565
  ( __param(5, ITextModelService)),
516
566
  ( __param(6, IQuickDiffService)),
517
567
  ( __param(7, IUriIdentityService)),
518
- ( __param(8, IWorkspaceContextService))
568
+ ( __param(8, IWorkspaceContextService)),
569
+ ( __param(9, ILogService))
519
570
  ], MainThreadSCM);
520
571
 
521
572
  export { MainThreadSCM };
@@ -106,7 +106,7 @@ let MainThreadTesting = class MainThreadTesting extends Disposable {
106
106
  let value = task.coverage.read(undefined);
107
107
  if (!value) {
108
108
  value = ( new TestCoverage(run, taskId, this.uriIdentityService, {
109
- getCoverageDetails: (id, token) => this.proxy.$getCoverageDetails(id, token)
109
+ getCoverageDetails: (id, testId, token) => this.proxy.$getCoverageDetails(id, testId, token)
110
110
  .then(r => ( r.map(CoverageDetails.deserialize))),
111
111
  }));
112
112
  value.append(deserialized, tx);
@@ -3,7 +3,6 @@ import { mainWindow } from 'vscode/vscode/vs/base/browser/window';
3
3
  import { Schemas } from 'vscode/vscode/vs/base/common/network';
4
4
  import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
5
5
  import { IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs.service';
6
- import { ExtensionType } from 'vscode/vscode/vs/platform/extensions/common/extensions';
7
6
  import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
8
7
  import 'vscode/vscode/vs/platform/instantiation/common/extensions';
9
8
  import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
@@ -53,16 +52,6 @@ let ExtensionService = class ExtensionService extends AbstractExtensionService {
53
52
  });
54
53
  this._initFetchFileSystem();
55
54
  }
56
- async _scanSingleExtension(extension) {
57
- if (extension.location.scheme === Schemas.vscodeRemote) {
58
- return this._remoteExtensionsScannerService.scanSingleExtension(extension.location, extension.type === ExtensionType.System);
59
- }
60
- const scannedExtension = await this._webExtensionsScannerService.scanExistingExtension(extension.location, extension.type, this._userDataProfileService.currentProfile.extensionsResource);
61
- if (scannedExtension) {
62
- return toExtensionDescription(scannedExtension);
63
- }
64
- return null;
65
- }
66
55
  _initFetchFileSystem() {
67
56
  const provider = ( new FetchFileSystemProvider());
68
57
  this._register(this._fileService.registerProvider(Schemas.http, provider));
@@ -3,7 +3,7 @@ import { Barrier } from 'vscode/vscode/vs/base/common/async';
3
3
  import { toErrorMessage } from 'vscode/vscode/vs/base/common/errorMessage';
4
4
  import { Emitter } from 'vscode/vscode/vs/base/common/event';
5
5
  import { MarkdownString } from 'vscode/vscode/vs/base/common/htmlContent';
6
- import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
6
+ import { Disposable, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
7
7
  import { Schemas } from 'vscode/vscode/vs/base/common/network';
8
8
  import { mark } from 'vscode/vscode/vs/base/common/performance';
9
9
  import { isCI } from 'vscode/vscode/vs/base/common/platform';
@@ -40,7 +40,7 @@ import { ExtensionHostManager } from './extensionHostManager.js';
40
40
  import { IExtensionManifestPropertiesService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensionManifestPropertiesService.service';
41
41
  import { RemoteRunningLocation, LocalProcessRunningLocation, LocalWebWorkerRunningLocation } from 'vscode/vscode/vs/workbench/services/extensions/common/extensionRunningLocation';
42
42
  import { ExtensionRunningLocationTracker, filterExtensionIdentifiers } from './extensionRunningLocationTracker.js';
43
- import { ExtensionHostStartup, ActivationKind, ExtensionPointContribution, ActivationTimes, toExtension } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
43
+ import { toExtensionDescription, ExtensionHostStartup, ActivationKind, ExtensionPointContribution, ActivationTimes, toExtension } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
44
44
  import { ExtensionsRegistry, ExtensionMessageCollector } from 'vscode/vscode/vs/workbench/services/extensions/common/extensionsRegistry';
45
45
  import { LazyCreateExtensionHostManager } from './lazyCreateExtensionHostManager.js';
46
46
  import { ResponsiveState } from 'vscode/vscode/vs/workbench/services/extensions/common/rpcProtocol';
@@ -96,7 +96,7 @@ let AbstractExtensionService = AbstractExtensionService_1 = class AbstractExtens
96
96
  this._remoteCrashTracker = ( (new ExtensionHostCrashTracker()));
97
97
  this._deltaExtensionsQueue = [];
98
98
  this._inHandleDeltaExtensions = false;
99
- this._extensionHostManagers = [];
99
+ this._extensionHostManagers = this._register(( (new ExtensionHostCollection())));
100
100
  this._resolveAuthorityAttempt = 0;
101
101
  this._register(this._fileService.onWillActivateFileSystemProvider(e => {
102
102
  if (e.scheme !== Schemas.vscodeRemote) {
@@ -172,15 +172,7 @@ let AbstractExtensionService = AbstractExtensionService_1 = class AbstractExtens
172
172
  }));
173
173
  }
174
174
  _getExtensionHostManagers(kind) {
175
- return this._extensionHostManagers.filter(extHostManager => extHostManager.kind === kind);
176
- }
177
- _getExtensionHostManagerByRunningLocation(runningLocation) {
178
- for (const extensionHostManager of this._extensionHostManagers) {
179
- if (extensionHostManager.representsRunningLocation(runningLocation)) {
180
- return extensionHostManager;
181
- }
182
- }
183
- return null;
175
+ return this._extensionHostManagers.getByKind(kind);
184
176
  }
185
177
  async _handleDeltaExtensions(item) {
186
178
  this._deltaExtensionsQueue.push(item);
@@ -226,7 +218,7 @@ let AbstractExtensionService = AbstractExtensionService_1 = class AbstractExtens
226
218
  const toAdd = [];
227
219
  for (let i = 0, len = _toAdd.length; i < len; i++) {
228
220
  const extension = _toAdd[i];
229
- const extensionDescription = await this._scanSingleExtension(extension);
221
+ const extensionDescription = toExtensionDescription(extension, false);
230
222
  if (!extensionDescription) {
231
223
  continue;
232
224
  }
@@ -458,7 +450,7 @@ let AbstractExtensionService = AbstractExtensionService_1 = class AbstractExtens
458
450
  }
459
451
  }
460
452
  if (runningLocation !== null) {
461
- return this._getExtensionHostManagerByRunningLocation(runningLocation);
453
+ return this._extensionHostManagers.getByRunningLocation(runningLocation);
462
454
  }
463
455
  return null;
464
456
  }
@@ -547,8 +539,8 @@ let AbstractExtensionService = AbstractExtensionService_1 = class AbstractExtens
547
539
  bestErrorResult.error.detail
548
540
  )));
549
541
  }
550
- stopExtensionHosts(reason) {
551
- return this._doStopExtensionHostsWithVeto(reason);
542
+ stopExtensionHosts(reason, auto) {
543
+ return this._doStopExtensionHostsWithVeto(reason, auto);
552
544
  }
553
545
  _doStopExtensionHosts() {
554
546
  const previouslyActivatedExtensionIds = [];
@@ -557,10 +549,7 @@ let AbstractExtensionService = AbstractExtensionService_1 = class AbstractExtens
557
549
  previouslyActivatedExtensionIds.push(extensionStatus.id);
558
550
  }
559
551
  }
560
- for (let i = this._extensionHostManagers.length - 1; i >= 0; i--) {
561
- this._extensionHostManagers[i].dispose();
562
- }
563
- this._extensionHostManagers = [];
552
+ this._extensionHostManagers.disposeAllInReverse();
564
553
  for (const extensionStatus of ( (this._extensionStatus.values()))) {
565
554
  extensionStatus.clearRuntimeStatus();
566
555
  }
@@ -568,7 +557,7 @@ let AbstractExtensionService = AbstractExtensionService_1 = class AbstractExtens
568
557
  this._onDidChangeExtensionsStatus.fire(previouslyActivatedExtensionIds);
569
558
  }
570
559
  }
571
- async _doStopExtensionHostsWithVeto(reason) {
560
+ async _doStopExtensionHostsWithVeto(reason, auto) {
572
561
  const vetos = [];
573
562
  const vetoReasons = ( (new Set()));
574
563
  this._onWillStop.fire({
@@ -596,21 +585,23 @@ let AbstractExtensionService = AbstractExtensionService_1 = class AbstractExtens
596
585
  this._doStopExtensionHosts();
597
586
  }
598
587
  else {
599
- const vetoReasonsArray = Array.from(vetoReasons);
600
- this._logService.warn(`Extension host was not stopped because of veto (stop reason: ${reason}, veto reason: ${vetoReasonsArray.join(', ')})`);
601
- await this._dialogService.warn(( localizeWithPath(_moduleId, 3, "The following operation was blocked: {0}", reason)), vetoReasonsArray.length === 1 ?
602
- ( localizeWithPath(
603
- _moduleId,
604
- 4,
605
- "The reason for blocking the operation: {0}",
606
- vetoReasonsArray[0]
607
- )) :
608
- ( localizeWithPath(
609
- _moduleId,
610
- 5,
611
- "The reasons for blocking the operation:\n- {0}",
612
- vetoReasonsArray.join('\n -')
613
- )));
588
+ if (!auto) {
589
+ const vetoReasonsArray = Array.from(vetoReasons);
590
+ this._logService.warn(`Extension host was not stopped because of veto (stop reason: ${reason}, veto reason: ${vetoReasonsArray.join(', ')})`);
591
+ await this._dialogService.warn(( localizeWithPath(_moduleId, 3, "The following operation was blocked: {0}", reason)), vetoReasonsArray.length === 1 ?
592
+ ( localizeWithPath(
593
+ _moduleId,
594
+ 4,
595
+ "The reason for blocking the operation: {0}",
596
+ vetoReasonsArray[0]
597
+ )) :
598
+ ( localizeWithPath(
599
+ _moduleId,
600
+ 5,
601
+ "The reasons for blocking the operation:\n- {0}",
602
+ vetoReasonsArray.join('\n -')
603
+ )));
604
+ }
614
605
  }
615
606
  return !veto;
616
607
  }
@@ -624,12 +615,13 @@ let AbstractExtensionService = AbstractExtensionService_1 = class AbstractExtens
624
615
  }
625
616
  locations.push(( (new RemoteRunningLocation())));
626
617
  for (const location of locations) {
627
- if (this._getExtensionHostManagerByRunningLocation(location)) {
618
+ if (this._extensionHostManagers.getByRunningLocation(location)) {
628
619
  continue;
629
620
  }
630
- const extHostManager = this._createExtensionHostManager(location, isInitialStart, initialActivationEvents);
631
- if (extHostManager) {
632
- this._extensionHostManagers.push(extHostManager);
621
+ const res = this._createExtensionHostManager(location, isInitialStart, initialActivationEvents);
622
+ if (res) {
623
+ const [extHostManager, disposableStore] = res;
624
+ this._extensionHostManagers.add(extHostManager, disposableStore);
633
625
  }
634
626
  }
635
627
  }
@@ -639,8 +631,9 @@ let AbstractExtensionService = AbstractExtensionService_1 = class AbstractExtens
639
631
  return null;
640
632
  }
641
633
  const processManager = this._doCreateExtensionHostManager(extensionHost, initialActivationEvents);
642
- processManager.onDidExit(([code, signal]) => this._onExtensionHostCrashOrExit(processManager, code, signal));
643
- processManager.onDidChangeResponsiveState((responsiveState) => {
634
+ const disposableStore = ( (new DisposableStore()));
635
+ disposableStore.add(processManager.onDidExit(([code, signal]) => this._onExtensionHostCrashOrExit(processManager, code, signal)));
636
+ disposableStore.add(processManager.onDidChangeResponsiveState((responsiveState) => {
644
637
  this._logService.info(`Extension host (${processManager.friendyName}) is ${responsiveState === ResponsiveState.Responsive ? 'responsive' : 'unresponsive'}.`);
645
638
  this._onDidChangeResponsiveChange.fire({
646
639
  extensionHostKind: processManager.kind,
@@ -649,8 +642,8 @@ let AbstractExtensionService = AbstractExtensionService_1 = class AbstractExtens
649
642
  return processManager.getInspectPort(tryEnableInspector);
650
643
  }
651
644
  });
652
- });
653
- return processManager;
645
+ }));
646
+ return [processManager, disposableStore];
654
647
  }
655
648
  _doCreateExtensionHostManager(extensionHost, initialActivationEvents) {
656
649
  const internalExtensionService = this._acquireInternalAPI(extensionHost);
@@ -676,13 +669,7 @@ let AbstractExtensionService = AbstractExtensionService_1 = class AbstractExtens
676
669
  if (signal) {
677
670
  this._onRemoteExtensionHostCrashed(extensionHost, signal);
678
671
  }
679
- for (let i = 0; i < this._extensionHostManagers.length; i++) {
680
- if (this._extensionHostManagers[i] === extensionHost) {
681
- this._extensionHostManagers[i].dispose();
682
- this._extensionHostManagers.splice(i, 1);
683
- break;
684
- }
685
- }
672
+ this._extensionHostManagers.disposeOne(extensionHost);
686
673
  }
687
674
  }
688
675
  _getExtensionHostExitInfoWithTimeout(reconnectionToken) {
@@ -995,6 +982,71 @@ AbstractExtensionService = AbstractExtensionService_1 = ( (__decorate([
995
982
  ( (__param(18, IRemoteAuthorityResolverService))),
996
983
  ( (__param(19, IDialogService)))
997
984
  ], AbstractExtensionService)));
985
+ class ExtensionHostCollection extends Disposable {
986
+ constructor() {
987
+ super(...arguments);
988
+ this._extensionHostManagers = [];
989
+ }
990
+ dispose() {
991
+ this.disposeAllInReverse();
992
+ super.dispose();
993
+ }
994
+ add(extensionHostManager, disposableStore) {
995
+ this._extensionHostManagers.push(( (new ExtensionHostManagerData(extensionHostManager, disposableStore))));
996
+ }
997
+ disposeAllInReverse() {
998
+ for (let i = this._extensionHostManagers.length - 1; i >= 0; i--) {
999
+ this._extensionHostManagers[i].dispose();
1000
+ }
1001
+ this._extensionHostManagers = [];
1002
+ }
1003
+ disposeOne(extensionHostManager) {
1004
+ const index = this._extensionHostManagers.findIndex(el => el.extensionHost === extensionHostManager);
1005
+ if (index >= 0) {
1006
+ this._extensionHostManagers.splice(index, 1);
1007
+ extensionHostManager.dispose();
1008
+ }
1009
+ }
1010
+ getByKind(kind) {
1011
+ return this.filter(el => el.kind === kind);
1012
+ }
1013
+ getByRunningLocation(runningLocation) {
1014
+ for (const el of this._extensionHostManagers) {
1015
+ if (el.extensionHost.representsRunningLocation(runningLocation)) {
1016
+ return el.extensionHost;
1017
+ }
1018
+ }
1019
+ return null;
1020
+ }
1021
+ *[Symbol.iterator]() {
1022
+ for (const extensionHostManager of this._extensionHostManagers) {
1023
+ yield extensionHostManager.extensionHost;
1024
+ }
1025
+ }
1026
+ map(callback) {
1027
+ return (
1028
+ (this._extensionHostManagers.map(el => callback(el.extensionHost)))
1029
+ );
1030
+ }
1031
+ every(callback) {
1032
+ return this._extensionHostManagers.every(el => callback(el.extensionHost));
1033
+ }
1034
+ filter(callback) {
1035
+ return (
1036
+ (this._extensionHostManagers.filter(el => callback(el.extensionHost)).map(el => el.extensionHost))
1037
+ );
1038
+ }
1039
+ }
1040
+ class ExtensionHostManagerData {
1041
+ constructor(extensionHost, disposableStore) {
1042
+ this.extensionHost = extensionHost;
1043
+ this.disposableStore = disposableStore;
1044
+ }
1045
+ dispose() {
1046
+ this.disposableStore.dispose();
1047
+ this.extensionHost.dispose();
1048
+ }
1049
+ }
998
1050
  class ResolvedExtensions {
999
1051
  constructor(local, remote, hasLocalProcess, allowRemoteExtensionsInLocalWebWorker) {
1000
1052
  this.local = local;