Skip to content

Commit

Permalink
#125395 Improve the prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
sandy081 committed Jun 3, 2021
1 parent 0624017 commit 788e39a
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/vs/workbench/api/browser/mainThreadExtensionService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { ILocalExtension } from 'vs/platform/extensionManagement/common/extensio
import { ExtensionActivationReason } from 'vs/workbench/api/common/extHostExtensionActivator';
import { ITimerService } from 'vs/workbench/services/timer/browser/timerService';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { ICommandService } from 'vs/platform/commands/common/commands';

@extHostNamedCustomer(MainContext.MainThreadExtensionService)
export class MainThreadExtensionService implements MainThreadExtensionServiceShape {
Expand All @@ -35,6 +36,7 @@ export class MainThreadExtensionService implements MainThreadExtensionServiceSha
@IHostService private readonly _hostService: IHostService,
@IWorkbenchExtensionEnablementService private readonly _extensionEnablementService: IWorkbenchExtensionEnablementService,
@ITimerService private readonly _timerService: ITimerService,
@ICommandService private readonly _commandService: ICommandService,
@IWorkbenchEnvironmentService protected readonly _environmentService: IWorkbenchEnvironmentService,
) {
this._extensionHostKind = extHostContext.extensionHostKind;
Expand Down Expand Up @@ -105,11 +107,20 @@ export class MainThreadExtensionService implements MainThreadExtensionServiceSha
});
} else {
const enablementState = this._extensionEnablementService.getEnablementState(missingInstalledDependency);
if (enablementState === EnablementState.DisabledByTrustRequirement || enablementState === EnablementState.DisabledByVirtualWorkspace) {
if (enablementState === EnablementState.DisabledByVirtualWorkspace) {
this._notificationService.notify({
severity: Severity.Error,
message: localize('notSupportedInWorkspace', "Cannot activate the '{0}' extension because it depends on the '{1}' extension which is not supported in the current workspace", extName, missingInstalledDependency.manifest.displayName || missingInstalledDependency.manifest.name),
});
} else if (enablementState === EnablementState.DisabledByTrustRequirement) {
this._notificationService.notify({
severity: Severity.Error,
message: localize('restrictedMode', "Cannot activate the '{0}' extension because it depends on the '{1}' extension which is not supported in Restricted Mode", extName, missingInstalledDependency.manifest.displayName || missingInstalledDependency.manifest.name),
actions: {
primary: [new Action('manageWorkspaceTrust', localize('manageWorkspaceTrust', "Manage Workspace Trust"), '', true,
() => this._commandService.executeCommand('workbench.trust.manage'))]
}
});
} else if (this._extensionEnablementService.canChangeEnablement(missingInstalledDependency)) {
this._notificationService.notify({
severity: Severity.Error,
Expand Down

0 comments on commit 788e39a

Please sign in to comment.