8
8
ILocalExtension , IGalleryExtension , IExtensionIdentifier , IExtensionsControlManifest , IExtensionGalleryService , InstallOptions , UninstallOptions , InstallExtensionResult , ExtensionManagementError , ExtensionManagementErrorCode , Metadata , InstallOperation , EXTENSION_INSTALL_SYNC_CONTEXT , InstallExtensionInfo ,
9
9
IProductVersion
10
10
} from 'vs/platform/extensionManagement/common/extensionManagement' ;
11
- import { DidChangeProfileForServerEvent , DidUninstallExtensionOnServerEvent , extensionsConfigurationNodeBase , IExtensionManagementServer , IExtensionManagementServerService , InstallExtensionOnServerEvent , IResourceExtension , IWorkbenchExtensionManagementService , UninstallExtensionOnServerEvent } from 'vs/workbench/services/extensionManagement/common/extensionManagement' ;
11
+ import { DidChangeProfileForServerEvent , DidUninstallExtensionOnServerEvent , IExtensionManagementServer , IExtensionManagementServerService , InstallExtensionOnServerEvent , IResourceExtension , IWorkbenchExtensionManagementService , UninstallExtensionOnServerEvent } from 'vs/workbench/services/extensionManagement/common/extensionManagement' ;
12
12
import { ExtensionType , isLanguagePackExtension , IExtensionManifest , getWorkspaceSupportTypeMessage , TargetPlatform } from 'vs/platform/extensions/common/extensions' ;
13
13
import { URI } from 'vs/base/common/uri' ;
14
14
import { Disposable , DisposableStore } from 'vs/base/common/lifecycle' ;
@@ -38,8 +38,6 @@ import { IExtensionsScannerService, IScannedExtension } from 'vs/platform/extens
38
38
import { IStorageService , StorageScope , StorageTarget } from 'vs/platform/storage/common/storage' ;
39
39
import { IUriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentity' ;
40
40
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry' ;
41
- import { Registry } from 'vs/platform/registry/common/platform' ;
42
- import { ConfigurationScope , Extensions , IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry' ;
43
41
44
42
export class ExtensionManagementService extends Disposable implements IWorkbenchExtensionManagementService {
45
43
@@ -64,7 +62,7 @@ export class ExtensionManagementService extends Disposable implements IWorkbench
64
62
65
63
protected readonly servers : IExtensionManagementServer [ ] = [ ] ;
66
64
67
- private readonly workspaceExtensionManagementService ? : WorkspaceExtensionsManagementService ;
65
+ private readonly workspaceExtensionManagementService : WorkspaceExtensionsManagementService ;
68
66
69
67
constructor (
70
68
@IExtensionManagementServerService protected readonly extensionManagementServerService : IExtensionManagementServerService ,
@@ -85,27 +83,8 @@ export class ExtensionManagementService extends Disposable implements IWorkbench
85
83
) {
86
84
super ( ) ;
87
85
88
- if ( productService . quality !== 'stable' ) {
89
- Registry . as < IConfigurationRegistry > ( Extensions . Configuration )
90
- . registerConfiguration ( {
91
- ...extensionsConfigurationNodeBase ,
92
- properties : {
93
- 'extensions.experimental.supportWorkspaceExtensions' : {
94
- type : 'boolean' ,
95
- description : localize ( 'extensions.experimental.supportWorkspaceExtensions' , "Enables support for workspace specific local extensions." ) ,
96
- default : false ,
97
- scope : ConfigurationScope . APPLICATION
98
- }
99
- }
100
- } ) ;
101
- }
102
-
103
- if ( this . productService . quality !== 'stable' && this . configurationService . getValue ( 'extensions.experimental.supportWorkspaceExtensions' ) === true ) {
104
- this . workspaceExtensionManagementService = this . _register ( this . instantiationService . createInstance ( WorkspaceExtensionsManagementService ) ) ;
105
- this . onDidEnableExtensions = this . workspaceExtensionManagementService . onDidChangeInvalidExtensions ;
106
- } else {
107
- this . onDidEnableExtensions = Event . None ;
108
- }
86
+ this . workspaceExtensionManagementService = this . _register ( this . instantiationService . createInstance ( WorkspaceExtensionsManagementService ) ) ;
87
+ this . onDidEnableExtensions = this . workspaceExtensionManagementService . onDidChangeInvalidExtensions ;
109
88
110
89
if ( this . extensionManagementServerService . localExtensionManagementServer ) {
111
90
this . servers . push ( this . extensionManagementServerService . localExtensionManagementServer ) ;
@@ -149,10 +128,6 @@ export class ExtensionManagementService extends Disposable implements IWorkbench
149
128
}
150
129
}
151
130
152
- isWorkspaceExtensionsSupported ( ) : boolean {
153
- return ! ! this . workspaceExtensionManagementService ;
154
- }
155
-
156
131
async getInstalled ( type ?: ExtensionType , profileLocation ?: URI , productVersion ?: IProductVersion ) : Promise < ILocalExtension [ ] > {
157
132
const result : ILocalExtension [ ] = [ ] ;
158
133
await Promise . all ( this . servers . map ( async server => {
@@ -430,13 +405,10 @@ export class ExtensionManagementService extends Disposable implements IWorkbench
430
405
}
431
406
432
407
async getExtensions ( locations : URI [ ] ) : Promise < IResourceExtension [ ] > {
433
- if ( ! this . workspaceExtensionManagementService ) {
434
- return [ ] ;
435
- }
436
408
const scannedExtensions = await this . extensionsScannerService . scanMultipleExtensions ( locations , ExtensionType . User , { includeInvalid : true } ) ;
437
409
const result : IResourceExtension [ ] = [ ] ;
438
410
await Promise . all ( scannedExtensions . map ( async scannedExtension => {
439
- const workspaceExtension = await this . workspaceExtensionManagementService ? .toLocalWorkspaceExtension ( scannedExtension ) ;
411
+ const workspaceExtension = await this . workspaceExtensionManagementService . toLocalWorkspaceExtension ( scannedExtension ) ;
440
412
if ( workspaceExtension ) {
441
413
result . push ( {
442
414
identifier : workspaceExtension . identifier ,
@@ -451,18 +423,14 @@ export class ExtensionManagementService extends Disposable implements IWorkbench
451
423
}
452
424
453
425
async getInstalledWorkspaceExtensions ( includeInvalid : boolean ) : Promise < ILocalExtension [ ] > {
454
- return this . workspaceExtensionManagementService ? .getInstalled ( includeInvalid ) ?? [ ] ;
426
+ return this . workspaceExtensionManagementService . getInstalled ( includeInvalid ) ;
455
427
}
456
428
457
429
async installResourceExtension ( extension : IResourceExtension , installOptions : InstallOptions ) : Promise < ILocalExtension > {
458
430
if ( ! installOptions . isWorkspaceScoped ) {
459
431
return this . installFromLocation ( extension . location ) ;
460
432
}
461
433
462
- if ( ! this . workspaceExtensionManagementService ) {
463
- throw new Error ( 'Workspace Extensions are not supported' ) ;
464
- }
465
-
466
434
this . logService . info ( `Installing the extension ${ extension . identifier . id } from ${ extension . location . toString ( ) } in workspace` ) ;
467
435
const server = this . getWorkspaceExtensionsServer ( ) ;
468
436
this . _onInstallExtension . fire ( {
@@ -510,10 +478,6 @@ export class ExtensionManagementService extends Disposable implements IWorkbench
510
478
throw new Error ( 'The extension is not a workspace extension' ) ;
511
479
}
512
480
513
- if ( ! this . workspaceExtensionManagementService ) {
514
- throw new Error ( 'Workspace Extensions are not supported' ) ;
515
- }
516
-
517
481
this . logService . info ( `Uninstalling the workspace extension ${ extension . identifier . id } from ${ extension . location . toString ( ) } ` ) ;
518
482
const server = this . getWorkspaceExtensionsServer ( ) ;
519
483
this . _onUninstallExtension . fire ( {
0 commit comments