@@ -10,7 +10,6 @@ import { IdleDeadline, DeferredPromise, runWhenGlobalIdle } from 'vs/base/common
1010import { mark } from 'vs/base/common/performance' ;
1111import { ILogService } from 'vs/platform/log/common/log' ;
1212import { IEnvironmentService } from 'vs/platform/environment/common/environment' ;
13- import { IFileService } from 'vs/platform/files/common/files' ;
1413import { getOrSet } from 'vs/base/common/map' ;
1514import { Disposable } from 'vs/base/common/lifecycle' ;
1615import { IEditorPaneService } from 'vs/workbench/services/editor/common/editorPaneService' ;
@@ -67,14 +66,6 @@ export interface ILazyWorkbenchContributionInstantiation {
6766 readonly lazy : true ;
6867}
6968
70- /**
71- * A workbench contribution that will be instantiated when the
72- * corresponding file system scheme is used.
73- */
74- export interface IOnFilesystemWorkbenchContributionInstantiation {
75- readonly scheme : string ;
76- }
77-
7869/**
7970 * A workbench contribution that will be instantiated when the
8071 * corresponding editor is being created.
@@ -83,17 +74,12 @@ export interface IOnEditorWorkbenchContributionInstantiation {
8374 readonly editorTypeId : string ;
8475}
8576
86- function isOnFilesystemWorkbenchContributionInstantiation ( obj : unknown ) : obj is IOnFilesystemWorkbenchContributionInstantiation {
87- const candidate = obj as IOnFilesystemWorkbenchContributionInstantiation | undefined ;
88- return ! ! candidate && typeof candidate . scheme === 'string' ;
89- }
90-
9177function isOnEditorWorkbenchContributionInstantiation ( obj : unknown ) : obj is IOnEditorWorkbenchContributionInstantiation {
9278 const candidate = obj as IOnEditorWorkbenchContributionInstantiation | undefined ;
9379 return ! ! candidate && typeof candidate . editorTypeId === 'string' ;
9480}
9581
96- export type WorkbenchContributionInstantiation = WorkbenchPhase | ILazyWorkbenchContributionInstantiation | IOnFilesystemWorkbenchContributionInstantiation | IOnEditorWorkbenchContributionInstantiation ;
82+ export type WorkbenchContributionInstantiation = WorkbenchPhase | ILazyWorkbenchContributionInstantiation | IOnEditorWorkbenchContributionInstantiation ;
9783
9884function toWorkbenchPhase ( phase : LifecyclePhase . Restored | LifecyclePhase . Eventually ) : WorkbenchPhase . AfterRestored | WorkbenchPhase . Eventually {
9985 switch ( phase ) {
@@ -160,11 +146,9 @@ export class WorkbenchContributionsRegistry extends Disposable implements IWorkb
160146 private lifecycleService : ILifecycleService | undefined ;
161147 private logService : ILogService | undefined ;
162148 private environmentService : IEnvironmentService | undefined ;
163- private fileService : IFileService | undefined ;
164149 private editorPaneService : IEditorPaneService | undefined ;
165150
166151 private readonly contributionsByPhase = new Map < LifecyclePhase , IWorkbenchContributionRegistration [ ] > ( ) ;
167- private readonly contributionsByFilesystem = new Map < string , IWorkbenchContributionRegistration [ ] > ( ) ;
168152 private readonly contributionsByEditor = new Map < string , IWorkbenchContributionRegistration [ ] > ( ) ;
169153 private readonly contributionsById = new Map < string , IWorkbenchContributionRegistration > ( ) ;
170154
@@ -179,17 +163,15 @@ export class WorkbenchContributionsRegistry extends Disposable implements IWorkb
179163 registerWorkbenchContribution2 ( id : string , ctor : IConstructorSignature < IWorkbenchContribution > , phase : WorkbenchPhase . BlockStartup | WorkbenchPhase . BlockRestore ) : void ;
180164 registerWorkbenchContribution2 ( id : string | undefined , ctor : IConstructorSignature < IWorkbenchContribution > , phase : WorkbenchPhase . AfterRestored | WorkbenchPhase . Eventually ) : void ;
181165 registerWorkbenchContribution2 ( id : string , ctor : IConstructorSignature < IWorkbenchContribution > , lazy : ILazyWorkbenchContributionInstantiation ) : void ;
182- registerWorkbenchContribution2 ( id : string , ctor : IConstructorSignature < IWorkbenchContribution > , onFileSystem : IOnFilesystemWorkbenchContributionInstantiation ) : void ;
183166 registerWorkbenchContribution2 ( id : string , ctor : IConstructorSignature < IWorkbenchContribution > , onEditor : IOnEditorWorkbenchContributionInstantiation ) : void ;
184167 registerWorkbenchContribution2 ( id : string | undefined , ctor : IConstructorSignature < IWorkbenchContribution > , instantiation : WorkbenchContributionInstantiation ) : void {
185168 const contribution : IWorkbenchContributionRegistration = { id, ctor } ;
186169
187170 // Instantiate directly if we already have a matching instantiation condition
188171 if (
189- this . instantiationService && this . lifecycleService && this . logService && this . environmentService && this . fileService && this . editorPaneService &&
172+ this . instantiationService && this . lifecycleService && this . logService && this . environmentService && this . editorPaneService &&
190173 (
191174 ( typeof instantiation === 'number' && this . lifecycleService . phase >= instantiation ) ||
192- ( typeof id === 'string' && isOnFilesystemWorkbenchContributionInstantiation ( instantiation ) && this . fileService . getProvider ( instantiation . scheme ) ) ||
193175 ( typeof id === 'string' && isOnEditorWorkbenchContributionInstantiation ( instantiation ) && this . editorPaneService . didInstantiateEditorPane ( instantiation . editorTypeId ) )
194176 )
195177 ) {
@@ -213,11 +195,6 @@ export class WorkbenchContributionsRegistry extends Disposable implements IWorkb
213195 console . error ( `IWorkbenchContributionsRegistry#registerWorkbenchContribution(): Can't register multiple contributions with same id '${ id } '` ) ;
214196 }
215197
216- // by filesystem
217- if ( isOnFilesystemWorkbenchContributionInstantiation ( instantiation ) ) {
218- getOrSet ( this . contributionsByFilesystem , instantiation . scheme , [ ] ) . push ( contribution ) ;
219- }
220-
221198 // by editor
222199 if ( isOnEditorWorkbenchContributionInstantiation ( instantiation ) ) {
223200 getOrSet ( this . contributionsByEditor , instantiation . editorTypeId , [ ] ) . push ( contribution ) ;
@@ -267,22 +244,13 @@ export class WorkbenchContributionsRegistry extends Disposable implements IWorkb
267244 const lifecycleService = this . lifecycleService = accessor . get ( ILifecycleService ) ;
268245 const logService = this . logService = accessor . get ( ILogService ) ;
269246 const environmentService = this . environmentService = accessor . get ( IEnvironmentService ) ;
270- const fileService = this . fileService = accessor . get ( IFileService ) ;
271247 const editorPaneService = this . editorPaneService = accessor . get ( IEditorPaneService ) ;
272248
273249 // Instantiate contributions by phase when they are ready
274250 for ( const phase of [ LifecyclePhase . Starting , LifecyclePhase . Ready , LifecyclePhase . Restored , LifecyclePhase . Eventually ] ) {
275251 this . instantiateByPhase ( instantiationService , lifecycleService , logService , environmentService , phase ) ;
276252 }
277253
278- // Instantiate contributions by filesystem when they are activated or ready
279- for ( const scheme of this . contributionsByFilesystem . keys ( ) ) {
280- if ( fileService . getProvider ( scheme ) ) {
281- this . onFilesystem ( scheme , instantiationService , lifecycleService , logService , environmentService ) ;
282- }
283- }
284- this . _register ( fileService . onWillActivateFileSystemProvider ( e => this . onFilesystem ( e . scheme , instantiationService , lifecycleService , logService , environmentService ) ) ) ;
285-
286254 // Instantiate contributions by editor when they are created or have been
287255 for ( const editorTypeId of this . contributionsByEditor . keys ( ) ) {
288256 if ( editorPaneService . didInstantiateEditorPane ( editorTypeId ) ) {
@@ -292,17 +260,6 @@ export class WorkbenchContributionsRegistry extends Disposable implements IWorkb
292260 this . _register ( editorPaneService . onWillInstantiateEditorPane ( e => this . onEditor ( e . typeId , instantiationService , lifecycleService , logService , environmentService ) ) ) ;
293261 }
294262
295- private onFilesystem ( scheme : string , instantiationService : IInstantiationService , lifecycleService : ILifecycleService , logService : ILogService , environmentService : IEnvironmentService ) : void {
296- const contributions = this . contributionsByFilesystem . get ( scheme ) ;
297- if ( contributions ) {
298- this . contributionsByFilesystem . delete ( scheme ) ;
299-
300- for ( const contribution of contributions ) {
301- this . safeCreateContribution ( instantiationService , logService , environmentService , contribution , lifecycleService . phase ) ;
302- }
303- }
304- }
305-
306263 private onEditor ( editorTypeId : string , instantiationService : IInstantiationService , lifecycleService : ILifecycleService , logService : ILogService , environmentService : IEnvironmentService ) : void {
307264 const contributions = this . contributionsByEditor . get ( editorTypeId ) ;
308265 if ( contributions ) {
0 commit comments