Skip to content

Commit f8c061e

Browse files
committed
restricted trust status bar item should use rich hover. Fixes microsoft#125408
1 parent 4b0c17e commit f8c061e

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/vs/workbench/contrib/workspace/browser/workspace.contribution.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import { IsWebContext } from 'vs/platform/contextkey/common/contextkeys';
3535
import { dirname, resolve } from 'vs/base/common/path';
3636
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
3737
import product from 'vs/platform/product/common/product';
38-
import { MarkdownString } from 'vs/base/common/htmlContent';
38+
import { IMarkdownString, MarkdownString } from 'vs/base/common/htmlContent';
3939
import { isSingleFolderWorkspaceIdentifier, toWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
4040
import { Schemas } from 'vs/base/common/network';
4141
import { STATUS_BAR_PROMINENT_ITEM_BACKGROUND, STATUS_BAR_PROMINENT_ITEM_FOREGROUND } from 'vs/workbench/common/theme';
@@ -45,6 +45,7 @@ import { IHostService } from 'vs/workbench/services/host/browser/host';
4545
import { IBannerItem, IBannerService } from 'vs/workbench/services/banner/browser/bannerService';
4646
import { isVirtualWorkspace } from 'vs/platform/remote/common/remoteHosts';
4747
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
48+
import { LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID } from 'vs/workbench/contrib/extensions/common/extensions';
4849

4950
const BANNER_RESTRICTED_MODE = 'workbench.banner.restrictedMode';
5051
const BANNER_VIRTUAL_WORKSPACE = 'workbench.banner.virtualWorkspace';
@@ -442,20 +443,33 @@ export class WorkspaceTrustUXHandler extends Disposable implements IWorkbenchCon
442443
const color = new ThemeColor(STATUS_BAR_PROMINENT_ITEM_FOREGROUND);
443444

444445
let ariaLabel = '';
446+
let toolTip: IMarkdownString | string | undefined;
445447
switch (this.workspaceContextService.getWorkbenchState()) {
446448
case WorkbenchState.EMPTY: {
447449
ariaLabel = trusted ? localize('status.ariaTrustedWindow', "This window is trusted.") :
448450
localize('status.ariaUntrustedWindow', "Restricted Mode: Some features are disabled because this window is not trusted.");
451+
toolTip = trusted ? ariaLabel : {
452+
value: localize('status.tooltipUntrustedWindow', "Restricted Mode: [Some features](command:{1}) are disabled because this window is not trusted.", LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID),
453+
isTrusted: true
454+
};
449455
break;
450456
}
451457
case WorkbenchState.FOLDER: {
452458
ariaLabel = trusted ? localize('status.ariaTrustedFolder', "This folder is trusted.") :
453459
localize('status.ariaUntrustedFolder', "Restricted Mode: Some features are disabled because this folder is not trusted.");
460+
toolTip = trusted ? ariaLabel : {
461+
value: localize('status.tooltipUntrustedFolder', "Restricted Mode: [Some features](command:{1}) are disabled because this folder is not trusted", LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID),
462+
isTrusted: true
463+
};
454464
break;
455465
}
456466
case WorkbenchState.WORKSPACE: {
457467
ariaLabel = trusted ? localize('status.ariaTrustedWorkspace', "This workspace is trusted.") :
458468
localize('status.ariaUntrustedWorkspace', "Restricted Mode: Some features are disabled because this workspace is not trusted.");
469+
toolTip = trusted ? ariaLabel : {
470+
value: localize('status.tooltipUntrustedWorkspace', "Restricted Mode: [Some features](command:{1}) are disabled because this workspace is not trusted", LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID),
471+
isTrusted: true
472+
};
459473
break;
460474
}
461475
}
@@ -464,7 +478,7 @@ export class WorkspaceTrustUXHandler extends Disposable implements IWorkbenchCon
464478
name: localize('status.WorkspaceTrust', "Workspace Trust"),
465479
text: trusted ? `$(shield)` : `$(shield) ${text}`,
466480
ariaLabel: ariaLabel,
467-
tooltip: ariaLabel,
481+
tooltip: toolTip,
468482
command: 'workbench.trust.manage',
469483
backgroundColor,
470484
color

0 commit comments

Comments
 (0)