Merge from vscode 4d91d96e5e121b38d33508cdef17868bab255eae

This commit is contained in:
ADS Merger
2020-06-18 04:32:54 +00:00
committed by AzureDataStudio
parent a971aee5bd
commit 5e7071e466
1002 changed files with 24201 additions and 13193 deletions

View File

@@ -23,7 +23,7 @@ const SOURCE = 'IWorkbenchExtensionEnablementService';
export class ExtensionEnablementService extends Disposable implements IWorkbenchExtensionEnablementService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
private readonly _onEnablementChanged = new Emitter<readonly IExtension[]>();
public readonly onEnablementChanged: Event<readonly IExtension[]> = this._onEnablementChanged.event;
@@ -121,6 +121,10 @@ export class ExtensionEnablementService extends Disposable implements IWorkbench
return enablementState === EnablementState.EnabledWorkspace || enablementState === EnablementState.EnabledGlobally;
}
isDisabledGlobally(extension: IExtension): boolean {
return this._isDisabledGlobally(extension.identifier);
}
private _isDisabledInEnv(extension: IExtension): boolean {
if (this.allUserExtensionsDisabled) {
return extension.type === ExtensionType.User;
@@ -168,12 +172,16 @@ export class ExtensionEnablementService extends Disposable implements IWorkbench
return EnablementState.DisabledWorkspace;
}
}
if (this.globalExtensionEnablementService.getDisabledExtensions().filter(e => areSameExtensions(e, identifier))[0]) {
if (this._isDisabledGlobally(identifier)) {
return EnablementState.DisabledGlobally;
}
return EnablementState.EnabledGlobally;
}
private _isDisabledGlobally(identifier: IExtensionIdentifier): boolean {
return this.globalExtensionEnablementService.getDisabledExtensions().some(e => areSameExtensions(e, identifier));
}
private _enableExtension(identifier: IExtensionIdentifier): Promise<boolean> {
this._removeFromWorkspaceDisabledExtensions(identifier);
this._removeFromWorkspaceEnabledExtensions(identifier);

View File

@@ -20,7 +20,7 @@ export interface IExtensionManagementServer {
}
export interface IExtensionManagementServerService {
_serviceBrand: undefined;
readonly _serviceBrand: undefined;
readonly localExtensionManagementServer: IExtensionManagementServer | null;
readonly remoteExtensionManagementServer: IExtensionManagementServer | null;
getExtensionManagementServer(location: URI): IExtensionManagementServer | null;
@@ -38,7 +38,7 @@ export const enum EnablementState {
export const IWorkbenchExtensionEnablementService = createDecorator<IWorkbenchExtensionEnablementService>('extensionEnablementService');
export interface IWorkbenchExtensionEnablementService {
_serviceBrand: undefined;
readonly _serviceBrand: undefined;
readonly allUserExtensionsDisabled: boolean;
@@ -62,6 +62,14 @@ export interface IWorkbenchExtensionEnablementService {
*/
isEnabled(extension: IExtension): boolean;
/**
* Returns `true` if the given extension identifier is disabled globally.
* Extensions can be disabled globally or in workspace or both.
* If an extension is disabled in both then enablement state shows only workspace.
* This will
*/
isDisabledGlobally(extension: IExtension): boolean;
/**
* Enable or disable the given extension.
* if `workspace` is `true` then enablement is done for workspace, otherwise globally.
@@ -115,7 +123,7 @@ export interface IExtensionRecommendationReson {
export const IExtensionRecommendationsService = createDecorator<IExtensionRecommendationsService>('extensionRecommendationsService');
export interface IExtensionRecommendationsService {
_serviceBrand: undefined;
readonly _serviceBrand: undefined;
getAllRecommendationsWithReason(): IStringDictionary<IExtensionRecommendationReson>;
getFileBasedRecommendations(): IExtensionRecommendation[];

View File

@@ -15,7 +15,7 @@ import { ILabelService } from 'vs/platform/label/common/label';
export class ExtensionManagementServerService implements IExtensionManagementServerService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
readonly localExtensionManagementServer: IExtensionManagementServer | null = null;
readonly remoteExtensionManagementServer: IExtensionManagementServer | null = null;

View File

@@ -22,7 +22,7 @@ import { IDownloadService } from 'vs/platform/download/common/download';
export class ExtensionManagementService extends Disposable implements IExtensionManagementService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
readonly onInstallExtension: Event<InstallExtensionEvent>;
readonly onDidInstallExtension: Event<DidInstallExtensionEvent>;

View File

@@ -24,9 +24,12 @@ const localExtensionManagementServerAuthority: string = 'vscode-local';
export class ExtensionManagementServerService implements IExtensionManagementServerService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
readonly localExtensionManagementServer: IExtensionManagementServer;
private readonly _localExtensionManagementServer: IExtensionManagementServer;
public get localExtensionManagementServer(): IExtensionManagementServer {
return this._localExtensionManagementServer;
}
readonly remoteExtensionManagementServer: IExtensionManagementServer | null = null;
readonly isSingleServer: boolean = false;
@@ -41,7 +44,7 @@ export class ExtensionManagementServerService implements IExtensionManagementSer
) {
const localExtensionManagementService = new ExtensionManagementChannelClient(sharedProcessService.getChannel('extensions'));
this.localExtensionManagementServer = { extensionManagementService: localExtensionManagementService, authority: localExtensionManagementServerAuthority, label: localize('local', "Local") };
this._localExtensionManagementServer = { extensionManagementService: localExtensionManagementService, authority: localExtensionManagementServerAuthority, label: localize('local', "Local") };
const remoteAgentConnection = remoteAgentService.getConnection();
if (remoteAgentConnection) {
const extensionManagementService = new RemoteExtensionManagementChannelClient(remoteAgentConnection.getChannel<IChannel>('extensions'), this.localExtensionManagementServer.extensionManagementService, galleryService, logService, configurationService, productService);