extHostExtensionActivator.ts ×20

Frontier kind: Code frontier

unlabeled · c_2dc4873fc7f4

8 tests · 14864 LOC · 61 files · introduces 0 tests · 71 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
21 ranges71 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1974 ranges14864 lines · 61 files · Browse complete extent
All tests (intent)
8 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

2 files ranked by introduced lines: 71 introduced LOC across 21 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/api/common/extHostExtensionActivator.ts 68 introduced LOC · 20 ranges

Open complete file

123
124 constructor(
125 > activationFailed: boolean, extHostExtensionActivator.ts
126 > activationFailedError: Error | null,
127 > activationTimes: ExtensionActivationTimes,
128 > module: IExtensionModule,
129 > exports: IExtensionAPI | undefined,
130 > disposable: IDisposable
131 > ) {
132 > this.activationFailed = activationFailed;
133 > this.activationFailedError = activationFailedError;
134 > this.activationTimes = activationTimes;
135 > this.module = module;
136 > this.exports = exports;
137 > this.disposable = disposable;
138 > }
139 }
140
190 public dispose(): void {
191 for (const [_, op] of this._operations) {
192 > op.dispose(); extHostExtensionActivator.ts
193 > }
194 }
195
203
204 public isActivated(extensionId: ExtensionIdentifier): boolean {
205 > const op = this._operations.get(extensionId); extHostExtensionActivator.ts
206 > return Boolean(op && op.value);
207 > }
208
209 public getActivatedExtension(extensionId: ExtensionIdentifier): ActivatedExtension {
216
217 public async activateByEvent(activationEvent: string, startup: boolean): Promise<void> {
218 > if (this._alreadyActivatedEvents[activationEvent]) { extHostExtensionActivator.ts
219 return;
220 }
222 > const activateExtensions = this._registry.getExtensionDescriptionsForActivationEvent(activationEvent);
223 > await this._activateExtensions(activateExtensions.map(e => ({
224 > id: e.identifier,
225 > reason: { startup, extensionId: e.identifier, activationEvent }
226 > })));
227
228 this._alreadyActivatedEvents[activationEvent] = true;
230
231 public activateById(extensionId: ExtensionIdentifier, reason: ExtensionActivationReason): Promise<void> {
238
239 private async _activateExtensions(extensions: ActivationIdAndReason[]): Promise<void> {
240 > const operations = extensions extHostExtensionActivator.ts
241 > .filter((p) => !this.isActivated(p.id))
242 > .map(ext => this._handleActivationRequest(ext));
243 > await Promise.all(operations.map(op => op.wait()));
244 > }
245
246 /**
249 */
250 private _handleActivationRequest(currentActivation: ActivationIdAndReason): ActivationOperation {
251 > if (this._operations.has(currentActivation.id)) { extHostExtensionActivator.ts
252 return this._operations.get(currentActivation.id)!;
253 }
255 > if (this._isHostExtension(currentActivation.id)) {
256 return this._createAndSaveOperation(currentActivation, null, [], null);
257 }
259 > const currentExtension = this._registry.getExtensionDescription(currentActivation.id);
260 > if (!currentExtension) {
261 // Error condition 0: unknown extension
262 const error = new Error(`Cannot activate unknown extension '${currentActivation.id.value}'`);
269 return result;
270 }
272 > const deps: ActivationOperation[] = [];
273 > const depIds = (typeof currentExtension.extensionDependencies === 'undefined' ? [] : currentExtension.extensionDependencies);
274 > for (const depId of depIds) {
275
276 if (this._isResolvedExtension(depId)) {
322
323 return this._createAndSaveOperation(currentActivation, currentExtension.displayName, deps, null);
325
326 private _createAndSaveOperation(activation: ActivationIdAndReason, displayName: string | null | undefined, deps: ActivationOperation[], value: ActivatedExtension | null): ActivationOperation {
327 > const operation = new ActivationOperation(activation.id, displayName, activation.reason, deps, value, this._host, this._logService); extHostExtensionActivator.ts
328 > this._operations.set(activation.id, operation);
329 > return operation;
330 > }
331
332 private _isHostExtension(extensionId: ExtensionIdentifier | string): boolean {
333 > return ExtensionDescriptionRegistry.isHostExtension(extensionId, this._registry, this._globalRegistry); extHostExtensionActivator.ts
334 > }
335
336 private _isResolvedExtension(extensionId: ExtensionIdentifier | string): boolean {
358
359 constructor(
360 > private readonly _id: ExtensionIdentifier, extHostExtensionActivator.ts
361 > private readonly _displayName: string | null | undefined,
362 > private readonly _reason: ExtensionActivationReason,
363 > private readonly _deps: ActivationOperation[],
364 > private _value: ActivatedExtension | null,
365 > private readonly _host: IExtensionsActivatorHost,
366 > @ILogService private readonly _logService: ILogService
367 > ) {
368 > this._initialize();
369 > }
370
371 public dispose(): void {
372 > this._isDisposed = true; extHostExtensionActivator.ts
373 > }
374
375 public wait() {
376 > return this._barrier.wait(); extHostExtensionActivator.ts
377 > }
378
379 private async _initialize(): Promise<void> {
380 > await this._waitForDepsThenActivate(); extHostExtensionActivator.ts
381 > this._barrier.open();
382 > }
383
384 private async _waitForDepsThenActivate(): Promise<void> {
385 > if (this._value) { extHostExtensionActivator.ts
386 // this operation is already finished
387 return;
src/vs/workbench/services/extensions/common/extensionDescriptionRegistry.ts 3 introduced LOC · 1 range

Open complete file

212
213 public getExtensionDescriptionsForActivationEvent(activationEvent: string): IExtensionDescription[] {
214 > const extensions = this._activationMap.get(activationEvent); extensionDescriptionRegistry.ts
215 > return extensions ? extensions.slice(0) : [];
216 > }
217
218 public getAllExtensionDescriptions(): IExtensionDescription[] {