Skip to content

Commit f8ca808

Browse files
committed
Get a basic list of running extensions
1 parent b8a1b66 commit f8ca808

8 files changed

Lines changed: 321 additions & 29 deletions

File tree

src/vs/platform/actions/test/common/menuService.test.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { NullCommandService } from 'vs/platform/commands/common/commands';
1212
import { MockContextKeyService } from 'vs/platform/keybinding/test/common/mockKeybindingService';
1313
import { IExtensionPoint } from 'vs/platform/extensions/common/extensionsRegistry';
1414
import { TPromise } from 'vs/base/common/winjs.base';
15-
import { ExtensionPointContribution, IExtensionDescription, IExtensionsStatus, IExtensionService, ActivationTimes } from 'vs/platform/extensions/common/extensions';
15+
import { ExtensionPointContribution, IExtensionDescription, IExtensionsStatus, IExtensionService } from 'vs/platform/extensions/common/extensions';
1616
import Event, { Emitter } from 'vs/base/common/event';
1717

1818
// --- service instances
@@ -25,6 +25,8 @@ class MockExtensionService implements IExtensionService {
2525
return this._onDidRegisterExtensions.event;
2626
}
2727

28+
onDidChangeExtensionsStatus = null;
29+
2830
public activateByEvent(activationEvent: string): TPromise<void> {
2931
throw new Error('Not implemented');
3032
}
@@ -45,10 +47,6 @@ class MockExtensionService implements IExtensionService {
4547
throw new Error('Not implemented');
4648
}
4749

48-
public getExtensionsActivationTimes(): { [id: string]: ActivationTimes; } {
49-
throw new Error('Not implemented');
50-
}
51-
5250
public restartExtensionHost(): void {
5351
throw new Error('Method not implemented.');
5452
}

src/vs/platform/commands/test/commandService.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class SimpleExtensionService implements IExtensionService {
2323
get onDidRegisterExtensions(): Event<IExtensionDescription[]> {
2424
return this._onDidRegisterExtensions.event;
2525
}
26+
onDidChangeExtensionsStatus = null;
2627
activateByEvent(activationEvent: string): TPromise<void> {
2728
return this.whenInstalledExtensionsRegistered().then(() => { });
2829
}
@@ -35,9 +36,6 @@ class SimpleExtensionService implements IExtensionService {
3536
getExtensionsStatus() {
3637
return undefined;
3738
}
38-
getExtensionsActivationTimes() {
39-
return undefined;
40-
}
4139
getExtensions(): TPromise<IExtensionDescription[]> {
4240
return TPromise.wrap([]);
4341
}

src/vs/platform/extensions/common/extensions.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export interface IMessage {
4242

4343
export interface IExtensionsStatus {
4444
messages: IMessage[];
45+
activationTimes: ActivationTimes;
4546
}
4647

4748
export class ActivationTimes {
@@ -72,6 +73,7 @@ export interface IExtensionService {
7273
_serviceBrand: any;
7374

7475
/**
76+
* TODO@Ben: Delete this and use `whenInstalledExtensionsRegistered`
7577
* An event emitted when extensions are registered after their extension points got handled.
7678
*
7779
* This event will also fire on startup to signal the installed extensions.
@@ -80,6 +82,13 @@ export interface IExtensionService {
8082
*/
8183
onDidRegisterExtensions: Event<IExtensionDescription[]>;
8284

85+
/**
86+
* @event
87+
* Fired when extensions status changes.
88+
* The event contains the ids of the extensions that have changed.
89+
*/
90+
onDidChangeExtensionsStatus: Event<string[]>;
91+
8392
/**
8493
* Send an activation event and activate interested extensions.
8594
*/
@@ -106,11 +115,6 @@ export interface IExtensionService {
106115
*/
107116
getExtensionsStatus(): { [id: string]: IExtensionsStatus };
108117

109-
/**
110-
* Get information about extension activation times.
111-
*/
112-
getExtensionsActivationTimes(): { [id: string]: ActivationTimes; };
113-
114118
/**
115119
* Restarts the extension host.
116120
*/

src/vs/workbench/electron-browser/actions.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ import { IPanel } from 'vs/workbench/common/panel';
4343
import { IWorkspaceIdentifier, getWorkspaceLabel, ISingleFolderWorkspaceIdentifier, isSingleFolderWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
4444
import { FileKind, IFileService } from 'vs/platform/files/common/files';
4545
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
46-
import { IExtensionService } from 'vs/platform/extensions/common/extensions';
46+
import { IExtensionService, ActivationTimes } from 'vs/platform/extensions/common/extensions';
4747
import { getEntries } from 'vs/base/common/performance';
4848
import { IEditor } from 'vs/platform/editor/common/editor';
4949

@@ -359,7 +359,15 @@ export class ShowStartupPerformance extends Action {
359359
(<any>console).groupEnd();
360360

361361
(<any>console).group('Extension Activation Stats');
362-
(<any>console).table(this.extensionService.getExtensionsActivationTimes());
362+
let extensionsActivationTimes: { [id: string]: ActivationTimes; } = {};
363+
let extensionsStatus = this.extensionService.getExtensionsStatus();
364+
for (let id in extensionsStatus) {
365+
const status = extensionsStatus[id];
366+
if (status.activationTimes) {
367+
extensionsActivationTimes[id] = status.activationTimes;
368+
}
369+
}
370+
(<any>console).table(extensionsActivationTimes);
363371
(<any>console).groupEnd();
364372

365373
(<any>console).group('Raw Startup Timers (CSV)');
@@ -1674,4 +1682,4 @@ export class ConfigureLocaleAction extends Action {
16741682
throw new Error(nls.localize('fail.createSettings', "Unable to create '{0}' ({1}).", getPathLabel(file, this.contextService), error));
16751683
});
16761684
}
1677-
}
1685+
}

src/vs/workbench/parts/extensions/electron-browser/extensions.contribution.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import { adoptToGalleryExtensionId } from 'vs/platform/extensionManagement/commo
4040
import { GalleryExtensionsHandler, ExtensionsHandler } from 'vs/workbench/parts/extensions/browser/extensionsQuickOpen';
4141
import { EditorDescriptor, IEditorRegistry, Extensions as EditorExtensions } from 'vs/workbench/browser/editor';
4242
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
43+
import { RuntimeExtensionsEditor, RuntimeExtensionsInput, ShowRuntimeExtensionsAction } from 'vs/workbench/parts/extensions/electron-browser/runtimeExtensionsEditor';
4344

4445
// Singletons
4546
registerSingleton(IExtensionGalleryService, ExtensionGalleryService);
@@ -88,6 +89,15 @@ const editorDescriptor = new EditorDescriptor(
8889
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
8990
.registerEditor(editorDescriptor, [new SyncDescriptor(ExtensionsInput)]);
9091

92+
const runtimeExtensionsEditorDescriptor = new EditorDescriptor(
93+
RuntimeExtensionsEditor,
94+
RuntimeExtensionsEditor.ID,
95+
localize('runtimeExtension', "Running Extensions")
96+
);
97+
98+
Registry.as<IEditorRegistry>(EditorExtensions.Editors)
99+
.registerEditor(runtimeExtensionsEditorDescriptor, [new SyncDescriptor(RuntimeExtensionsInput)]);
100+
91101
// Viewlet
92102
const viewletDescriptor = new ViewletDescriptor(
93103
ExtensionsViewlet,
@@ -162,6 +172,7 @@ actionRegistry.registerWorkbenchAction(checkForUpdatesAction, `Extensions: Check
162172

163173
actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(EnableAutoUpdateAction, EnableAutoUpdateAction.ID, EnableAutoUpdateAction.LABEL), `Extensions: Enable Auto Updating Extensions`, ExtensionsLabel);
164174
actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(DisableAutoUpdateAction, DisableAutoUpdateAction.ID, DisableAutoUpdateAction.LABEL), `Extensions: Disable Auto Updating Extensions`, ExtensionsLabel);
175+
actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(ShowRuntimeExtensionsAction, ShowRuntimeExtensionsAction.ID, ShowRuntimeExtensionsAction.LABEL, { primary: KeyCode.F2 }), 'Show Running Extensions', ExtensionsLabel);
165176

166177
Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration)
167178
.registerConfiguration({
@@ -194,4 +205,4 @@ CommandsRegistry.registerCommand('_extensions.manage', (accessor: ServicesAccess
194205
if (extension.length === 1) {
195206
extensionService.open(extension[0]).done(null, errors.onUnexpectedError);
196207
}
197-
});
208+
});
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
.runtime-extensions-editor .icon {
7+
width: 42px;
8+
height: 42px;
9+
padding: 10px 14px 10px 0;
10+
float: left;
11+
}

0 commit comments

Comments
 (0)