@@ -10,7 +10,6 @@ import { IdleDeadline, DeferredPromise, runWhenGlobalIdle } from 'vs/base/common
10
10
import { mark } from 'vs/base/common/performance' ;
11
11
import { ILogService } from 'vs/platform/log/common/log' ;
12
12
import { IEnvironmentService } from 'vs/platform/environment/common/environment' ;
13
- import { IFileService } from 'vs/platform/files/common/files' ;
14
13
import { getOrSet } from 'vs/base/common/map' ;
15
14
import { Disposable } from 'vs/base/common/lifecycle' ;
16
15
import { IEditorPaneService } from 'vs/workbench/services/editor/common/editorPaneService' ;
@@ -67,14 +66,6 @@ export interface ILazyWorkbenchContributionInstantiation {
67
66
readonly lazy : true ;
68
67
}
69
68
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
-
78
69
/**
79
70
* A workbench contribution that will be instantiated when the
80
71
* corresponding editor is being created.
@@ -83,17 +74,12 @@ export interface IOnEditorWorkbenchContributionInstantiation {
83
74
readonly editorTypeId : string ;
84
75
}
85
76
86
- function isOnFilesystemWorkbenchContributionInstantiation ( obj : unknown ) : obj is IOnFilesystemWorkbenchContributionInstantiation {
87
- const candidate = obj as IOnFilesystemWorkbenchContributionInstantiation | undefined ;
88
- return ! ! candidate && typeof candidate . scheme === 'string' ;
89
- }
90
-
91
77
function isOnEditorWorkbenchContributionInstantiation ( obj : unknown ) : obj is IOnEditorWorkbenchContributionInstantiation {
92
78
const candidate = obj as IOnEditorWorkbenchContributionInstantiation | undefined ;
93
79
return ! ! candidate && typeof candidate . editorTypeId === 'string' ;
94
80
}
95
81
96
- export type WorkbenchContributionInstantiation = WorkbenchPhase | ILazyWorkbenchContributionInstantiation | IOnFilesystemWorkbenchContributionInstantiation | IOnEditorWorkbenchContributionInstantiation ;
82
+ export type WorkbenchContributionInstantiation = WorkbenchPhase | ILazyWorkbenchContributionInstantiation | IOnEditorWorkbenchContributionInstantiation ;
97
83
98
84
function toWorkbenchPhase ( phase : LifecyclePhase . Restored | LifecyclePhase . Eventually ) : WorkbenchPhase . AfterRestored | WorkbenchPhase . Eventually {
99
85
switch ( phase ) {
@@ -160,11 +146,9 @@ export class WorkbenchContributionsRegistry extends Disposable implements IWorkb
160
146
private lifecycleService : ILifecycleService | undefined ;
161
147
private logService : ILogService | undefined ;
162
148
private environmentService : IEnvironmentService | undefined ;
163
- private fileService : IFileService | undefined ;
164
149
private editorPaneService : IEditorPaneService | undefined ;
165
150
166
151
private readonly contributionsByPhase = new Map < LifecyclePhase , IWorkbenchContributionRegistration [ ] > ( ) ;
167
- private readonly contributionsByFilesystem = new Map < string , IWorkbenchContributionRegistration [ ] > ( ) ;
168
152
private readonly contributionsByEditor = new Map < string , IWorkbenchContributionRegistration [ ] > ( ) ;
169
153
private readonly contributionsById = new Map < string , IWorkbenchContributionRegistration > ( ) ;
170
154
@@ -179,17 +163,15 @@ export class WorkbenchContributionsRegistry extends Disposable implements IWorkb
179
163
registerWorkbenchContribution2 ( id : string , ctor : IConstructorSignature < IWorkbenchContribution > , phase : WorkbenchPhase . BlockStartup | WorkbenchPhase . BlockRestore ) : void ;
180
164
registerWorkbenchContribution2 ( id : string | undefined , ctor : IConstructorSignature < IWorkbenchContribution > , phase : WorkbenchPhase . AfterRestored | WorkbenchPhase . Eventually ) : void ;
181
165
registerWorkbenchContribution2 ( id : string , ctor : IConstructorSignature < IWorkbenchContribution > , lazy : ILazyWorkbenchContributionInstantiation ) : void ;
182
- registerWorkbenchContribution2 ( id : string , ctor : IConstructorSignature < IWorkbenchContribution > , onFileSystem : IOnFilesystemWorkbenchContributionInstantiation ) : void ;
183
166
registerWorkbenchContribution2 ( id : string , ctor : IConstructorSignature < IWorkbenchContribution > , onEditor : IOnEditorWorkbenchContributionInstantiation ) : void ;
184
167
registerWorkbenchContribution2 ( id : string | undefined , ctor : IConstructorSignature < IWorkbenchContribution > , instantiation : WorkbenchContributionInstantiation ) : void {
185
168
const contribution : IWorkbenchContributionRegistration = { id, ctor } ;
186
169
187
170
// Instantiate directly if we already have a matching instantiation condition
188
171
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 &&
190
173
(
191
174
( typeof instantiation === 'number' && this . lifecycleService . phase >= instantiation ) ||
192
- ( typeof id === 'string' && isOnFilesystemWorkbenchContributionInstantiation ( instantiation ) && this . fileService . getProvider ( instantiation . scheme ) ) ||
193
175
( typeof id === 'string' && isOnEditorWorkbenchContributionInstantiation ( instantiation ) && this . editorPaneService . didInstantiateEditorPane ( instantiation . editorTypeId ) )
194
176
)
195
177
) {
@@ -213,11 +195,6 @@ export class WorkbenchContributionsRegistry extends Disposable implements IWorkb
213
195
console . error ( `IWorkbenchContributionsRegistry#registerWorkbenchContribution(): Can't register multiple contributions with same id '${ id } '` ) ;
214
196
}
215
197
216
- // by filesystem
217
- if ( isOnFilesystemWorkbenchContributionInstantiation ( instantiation ) ) {
218
- getOrSet ( this . contributionsByFilesystem , instantiation . scheme , [ ] ) . push ( contribution ) ;
219
- }
220
-
221
198
// by editor
222
199
if ( isOnEditorWorkbenchContributionInstantiation ( instantiation ) ) {
223
200
getOrSet ( this . contributionsByEditor , instantiation . editorTypeId , [ ] ) . push ( contribution ) ;
@@ -267,22 +244,13 @@ export class WorkbenchContributionsRegistry extends Disposable implements IWorkb
267
244
const lifecycleService = this . lifecycleService = accessor . get ( ILifecycleService ) ;
268
245
const logService = this . logService = accessor . get ( ILogService ) ;
269
246
const environmentService = this . environmentService = accessor . get ( IEnvironmentService ) ;
270
- const fileService = this . fileService = accessor . get ( IFileService ) ;
271
247
const editorPaneService = this . editorPaneService = accessor . get ( IEditorPaneService ) ;
272
248
273
249
// Instantiate contributions by phase when they are ready
274
250
for ( const phase of [ LifecyclePhase . Starting , LifecyclePhase . Ready , LifecyclePhase . Restored , LifecyclePhase . Eventually ] ) {
275
251
this . instantiateByPhase ( instantiationService , lifecycleService , logService , environmentService , phase ) ;
276
252
}
277
253
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
-
286
254
// Instantiate contributions by editor when they are created or have been
287
255
for ( const editorTypeId of this . contributionsByEditor . keys ( ) ) {
288
256
if ( editorPaneService . didInstantiateEditorPane ( editorTypeId ) ) {
@@ -292,17 +260,6 @@ export class WorkbenchContributionsRegistry extends Disposable implements IWorkb
292
260
this . _register ( editorPaneService . onWillInstantiateEditorPane ( e => this . onEditor ( e . typeId , instantiationService , lifecycleService , logService , environmentService ) ) ) ;
293
261
}
294
262
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
-
306
263
private onEditor ( editorTypeId : string , instantiationService : IInstantiationService , lifecycleService : ILifecycleService , logService : ILogService , environmentService : IEnvironmentService ) : void {
307
264
const contributions = this . contributionsByEditor . get ( editorTypeId ) ;
308
265
if ( contributions ) {
0 commit comments