@@ -6,59 +6,10 @@ import * as assert from 'assert';
66import { IDisposable , dispose } from 'vs/base/common/lifecycle' ;
77import { CommandsRegistry } from 'vs/platform/commands/common/commands' ;
88import { CommandService } from 'vs/workbench/services/commands/common/commandService' ;
9- import { IExtensionService , ExtensionPointContribution , IExtensionDescription , ProfileSession } from 'vs/workbench/services/extensions/common/extensions' ;
9+ import { NullExtensionService } from 'vs/workbench/services/extensions/common/extensions' ;
1010import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService' ;
11- import { IExtensionPoint } from 'vs/workbench/services/extensions/common/extensionsRegistry' ;
12- import { Event , Emitter } from 'vs/base/common/event' ;
1311import { NullLogService } from 'vs/platform/log/common/log' ;
1412
15- class SimpleExtensionService implements IExtensionService {
16- _serviceBrand : any ;
17- private _onDidRegisterExtensions = new Emitter < void > ( ) ;
18- get onDidRegisterExtensions ( ) : Event < void > {
19- return this . _onDidRegisterExtensions . event ;
20- }
21- onDidChangeExtensionsStatus = null ! ;
22- onDidChangeExtensions = null ! ;
23- onWillActivateByEvent = null ! ;
24- onDidChangeResponsiveChange = null ! ;
25- activateByEvent ( activationEvent : string ) : Promise < void > {
26- return this . whenInstalledExtensionsRegistered ( ) . then ( ( ) => { } ) ;
27- }
28- whenInstalledExtensionsRegistered ( ) : Promise < boolean > {
29- return Promise . resolve ( true ) ;
30- }
31- readExtensionPointContributions < T > ( extPoint : IExtensionPoint < T > ) : Promise < ExtensionPointContribution < T > [ ] > {
32- return Promise . resolve ( [ ] ) ;
33- }
34- getExtensionsStatus ( ) {
35- return undefined ! ;
36- }
37- getExtensions ( ) : Promise < IExtensionDescription [ ] > {
38- return Promise . resolve ( [ ] ) ;
39- }
40- getExtension ( ) {
41- return Promise . resolve ( undefined ) ;
42- }
43- canProfileExtensionHost ( ) {
44- return false ;
45- }
46- startExtensionHostProfile ( ) : Promise < ProfileSession > {
47- throw new Error ( 'Not implemented' ) ;
48- }
49- getInspectPort ( ) : number {
50- return 0 ;
51- }
52- restartExtensionHost ( ) : void {
53- }
54- startExtensionHost ( ) : void {
55- }
56- stopExtensionHost ( ) : void {
57- }
58- canAddExtension ( ) : boolean { return false ; }
59- canRemoveExtension ( ) : boolean { return false ; }
60- }
61-
6213suite ( 'CommandService' , function ( ) {
6314
6415 let commandRegistration : IDisposable ;
@@ -75,7 +26,7 @@ suite('CommandService', function () {
7526
7627 let lastEvent : string ;
7728
78- let service = new CommandService ( new InstantiationService ( ) , new class extends SimpleExtensionService {
29+ let service = new CommandService ( new InstantiationService ( ) , new class extends NullExtensionService {
7930 activateByEvent ( activationEvent : string ) : Promise < void > {
8031 lastEvent = activationEvent ;
8132 return super . activateByEvent ( activationEvent ) ;
@@ -94,7 +45,7 @@ suite('CommandService', function () {
9445
9546 test ( 'fwd activation error' , async function ( ) {
9647
97- const extensionService = new class extends SimpleExtensionService {
48+ const extensionService = new class extends NullExtensionService {
9849 activateByEvent ( activationEvent : string ) : Promise < void > {
9950 return Promise . reject ( new Error ( 'bad_activate' ) ) ;
10051 }
@@ -114,7 +65,7 @@ suite('CommandService', function () {
11465 let callCounter = 0 ;
11566 let reg = CommandsRegistry . registerCommand ( 'bar' , ( ) => callCounter += 1 ) ;
11667
117- let service = new CommandService ( new InstantiationService ( ) , new class extends SimpleExtensionService {
68+ let service = new CommandService ( new InstantiationService ( ) , new class extends NullExtensionService {
11869 whenInstalledExtensionsRegistered ( ) {
11970 return new Promise < boolean > ( _resolve => { /*ignore*/ } ) ;
12071 }
@@ -131,7 +82,7 @@ suite('CommandService', function () {
13182 let resolveFunc : Function ;
13283 const whenInstalledExtensionsRegistered = new Promise < boolean > ( _resolve => { resolveFunc = _resolve ; } ) ;
13384
134- let service = new CommandService ( new InstantiationService ( ) , new class extends SimpleExtensionService {
85+ let service = new CommandService ( new InstantiationService ( ) , new class extends NullExtensionService {
13586 whenInstalledExtensionsRegistered ( ) {
13687 return whenInstalledExtensionsRegistered ;
13788 }
@@ -154,7 +105,7 @@ suite('CommandService', function () {
154105 let callCounter = 0 ;
155106 let dispoables : IDisposable [ ] = [ ] ;
156107 let events : string [ ] = [ ] ;
157- let service = new CommandService ( new InstantiationService ( ) , new class extends SimpleExtensionService {
108+ let service = new CommandService ( new InstantiationService ( ) , new class extends NullExtensionService {
158109
159110 activateByEvent ( event : string ) : Promise < void > {
160111 events . push ( event ) ;
0 commit comments