Skip to content

Commit 87050ca

Browse files
authored
Add descriptions for commands microsoft#209511 (microsoft#209524)
1 parent 1e765ad commit 87050ca

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

src/vs/workbench/browser/actions/layoutActions.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { localize, localize2 } from 'vs/nls';
6+
import { ILocalizedString, localize, localize2 } from 'vs/nls';
77
import { MenuId, MenuRegistry, registerAction2, Action2 } from 'vs/platform/actions/common/actions';
88
import { Categories } from 'vs/platform/action/common/actionCommonCategories';
99
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
@@ -447,12 +447,13 @@ registerAction2(ToggleStatusbarVisibilityAction);
447447

448448
abstract class AbstractSetShowTabsAction extends Action2 {
449449

450-
constructor(private readonly settingName: string, private readonly value: string, title: ICommandActionTitle, id: string, precondition: ContextKeyExpression) {
450+
constructor(private readonly settingName: string, private readonly value: string, title: ICommandActionTitle, id: string, precondition: ContextKeyExpression, description: string | ILocalizedString | undefined) {
451451
super({
452452
id,
453453
title,
454454
category: Categories.View,
455455
precondition,
456+
metadata: description ? { description } : undefined,
456457
f1: true
457458
});
458459
}
@@ -472,7 +473,7 @@ export class HideEditorTabsAction extends AbstractSetShowTabsAction {
472473
constructor() {
473474
const precondition = ContextKeyExpr.and(ContextKeyExpr.equals(`config.${LayoutSettings.EDITOR_TABS_MODE}`, EditorTabsMode.NONE).negate(), InEditorZenModeContext.negate())!;
474475
const title = localize2('hideEditorTabs', 'Hide Editor Tabs');
475-
super(LayoutSettings.EDITOR_TABS_MODE, EditorTabsMode.NONE, title, HideEditorTabsAction.ID, precondition);
476+
super(LayoutSettings.EDITOR_TABS_MODE, EditorTabsMode.NONE, title, HideEditorTabsAction.ID, precondition, localize2('hideEditorTabsDescription', "Hide Tab Bar"));
476477
}
477478
}
478479

@@ -483,7 +484,7 @@ export class ZenHideEditorTabsAction extends AbstractSetShowTabsAction {
483484
constructor() {
484485
const precondition = ContextKeyExpr.and(ContextKeyExpr.equals(`config.${ZenModeSettings.SHOW_TABS}`, EditorTabsMode.NONE).negate(), InEditorZenModeContext)!;
485486
const title = localize2('hideEditorTabsZenMode', 'Hide Editor Tabs in Zen Mode');
486-
super(ZenModeSettings.SHOW_TABS, EditorTabsMode.NONE, title, ZenHideEditorTabsAction.ID, precondition);
487+
super(ZenModeSettings.SHOW_TABS, EditorTabsMode.NONE, title, ZenHideEditorTabsAction.ID, precondition, localize2('hideEditorTabsZenModeDescription', "Hide Tab Bar in Zen Mode"));
487488
}
488489
}
489490

@@ -497,7 +498,7 @@ export class ShowMultipleEditorTabsAction extends AbstractSetShowTabsAction {
497498
const precondition = ContextKeyExpr.and(ContextKeyExpr.equals(`config.${LayoutSettings.EDITOR_TABS_MODE}`, EditorTabsMode.MULTIPLE).negate(), InEditorZenModeContext.negate())!;
498499
const title = localize2('showMultipleEditorTabs', 'Show Multiple Editor Tabs');
499500

500-
super(LayoutSettings.EDITOR_TABS_MODE, EditorTabsMode.MULTIPLE, title, ShowMultipleEditorTabsAction.ID, precondition);
501+
super(LayoutSettings.EDITOR_TABS_MODE, EditorTabsMode.MULTIPLE, title, ShowMultipleEditorTabsAction.ID, precondition, localize2('showMultipleEditorTabsDescription', "Show Tab Bar with multiple tabs"));
501502
}
502503
}
503504

@@ -509,7 +510,7 @@ export class ZenShowMultipleEditorTabsAction extends AbstractSetShowTabsAction {
509510
const precondition = ContextKeyExpr.and(ContextKeyExpr.equals(`config.${ZenModeSettings.SHOW_TABS}`, EditorTabsMode.MULTIPLE).negate(), InEditorZenModeContext)!;
510511
const title = localize2('showMultipleEditorTabsZenMode', 'Show Multiple Editor Tabs in Zen Mode');
511512

512-
super(ZenModeSettings.SHOW_TABS, EditorTabsMode.MULTIPLE, title, ZenShowMultipleEditorTabsAction.ID, precondition);
513+
super(ZenModeSettings.SHOW_TABS, EditorTabsMode.MULTIPLE, title, ZenShowMultipleEditorTabsAction.ID, precondition, localize2('showMultipleEditorTabsZenModeDescription', "Show Tab Bar in Zen Mode"));
513514
}
514515
}
515516

@@ -523,7 +524,7 @@ export class ShowSingleEditorTabAction extends AbstractSetShowTabsAction {
523524
const precondition = ContextKeyExpr.and(ContextKeyExpr.equals(`config.${LayoutSettings.EDITOR_TABS_MODE}`, EditorTabsMode.SINGLE).negate(), InEditorZenModeContext.negate())!;
524525
const title = localize2('showSingleEditorTab', 'Show Single Editor Tab');
525526

526-
super(LayoutSettings.EDITOR_TABS_MODE, EditorTabsMode.SINGLE, title, ShowSingleEditorTabAction.ID, precondition);
527+
super(LayoutSettings.EDITOR_TABS_MODE, EditorTabsMode.SINGLE, title, ShowSingleEditorTabAction.ID, precondition, localize2('showSingleEditorTabDescription', "Show Tab Bar with one Tab"));
527528
}
528529
}
529530

@@ -535,7 +536,7 @@ export class ZenShowSingleEditorTabAction extends AbstractSetShowTabsAction {
535536
const precondition = ContextKeyExpr.and(ContextKeyExpr.equals(`config.${ZenModeSettings.SHOW_TABS}`, EditorTabsMode.SINGLE).negate(), InEditorZenModeContext)!;
536537
const title = localize2('showSingleEditorTabZenMode', 'Show Single Editor Tab in Zen Mode');
537538

538-
super(ZenModeSettings.SHOW_TABS, EditorTabsMode.SINGLE, title, ZenShowSingleEditorTabAction.ID, precondition);
539+
super(ZenModeSettings.SHOW_TABS, EditorTabsMode.SINGLE, title, ZenShowSingleEditorTabAction.ID, precondition, localize2('showSingleEditorTabZenModeDescription', "Show Tab Bar in Zen Mode with one Tab"));
539540
}
540541
}
541542

@@ -576,6 +577,7 @@ export class EditorActionsTitleBarAction extends Action2 {
576577
title: localize2('moveEditorActionsToTitleBar', "Move Editor Actions to Title Bar"),
577578
category: Categories.View,
578579
precondition: ContextKeyExpr.equals(`config.${LayoutSettings.EDITOR_ACTIONS_LOCATION}`, EditorActionsLocation.TITLEBAR).negate(),
580+
metadata: { description: localize2('moveEditorActionsToTitleBarDescription', "Move Editor Actions from the tab bar to the title bar") },
579581
f1: true
580582
});
581583
}
@@ -602,6 +604,7 @@ export class EditorActionsDefaultAction extends Action2 {
602604
ContextKeyExpr.equals(`config.${LayoutSettings.EDITOR_ACTIONS_LOCATION}`, EditorActionsLocation.DEFAULT).negate(),
603605
ContextKeyExpr.equals(`config.${LayoutSettings.EDITOR_TABS_MODE}`, EditorTabsMode.NONE).negate(),
604606
),
607+
metadata: { description: localize2('moveEditorActionsToTabBarDescription', "Move Editor Actions from the title bar to the tab bar") },
605608
f1: true
606609
});
607610
}
@@ -625,6 +628,7 @@ export class HideEditorActionsAction extends Action2 {
625628
title: localize2('hideEditorActons', "Hide Editor Actions"),
626629
category: Categories.View,
627630
precondition: ContextKeyExpr.equals(`config.${LayoutSettings.EDITOR_ACTIONS_LOCATION}`, EditorActionsLocation.HIDDEN).negate(),
631+
metadata: { description: localize2('hideEditorActonsDescription', "Hide Editor Actions in the tab and title bar") },
628632
f1: true
629633
});
630634
}
@@ -648,6 +652,7 @@ export class ShowEditorActionsAction extends Action2 {
648652
title: localize2('showEditorActons', "Show Editor Actions"),
649653
category: Categories.View,
650654
precondition: ContextKeyExpr.equals(`config.${LayoutSettings.EDITOR_ACTIONS_LOCATION}`, EditorActionsLocation.HIDDEN),
655+
metadata: { description: localize2('showEditorActonsDescription', "Make Editor Actions visible.") },
651656
f1: true
652657
});
653658
}
@@ -678,6 +683,7 @@ registerAction2(class extends Action2 {
678683
title: localize2('toggleSeparatePinnedEditorTabs', "Separate Pinned Editor Tabs"),
679684
category: Categories.View,
680685
precondition: ContextKeyExpr.equals(`config.${LayoutSettings.EDITOR_TABS_MODE}`, EditorTabsMode.MULTIPLE),
686+
metadata: { description: localize2('toggleSeparatePinnedEditorTabsDescription', "Toggle whether pinned editor tabs are shown on a separate row above unpinned tabs.") },
681687
f1: true
682688
});
683689
}

src/vs/workbench/browser/actions/listCommands.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -917,6 +917,7 @@ registerAction2(class ToggleStickyScroll extends Action2 {
917917
mnemonicTitle: localize({ key: 'mitoggleTreeStickyScroll', comment: ['&& denotes a mnemonic'] }, "&&Toggle Tree Sticky Scroll"),
918918
},
919919
category: 'View',
920+
metadata: { description: localize('toggleTreeStickyScrollDescription', "Toggles Sticky Scroll widget at the top of tree structures such as the File Explorer and Debug variables View.") },
920921
f1: true
921922
});
922923
}

src/vs/workbench/browser/parts/titlebar/titlebarActions.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { localize, localize2 } from 'vs/nls';
6+
import { ILocalizedString, localize, localize2 } from 'vs/nls';
77
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
88
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
99
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
@@ -19,11 +19,12 @@ import { CustomTitleBarVisibility, TitleBarSetting, TitlebarStyle } from 'vs/pla
1919

2020
class ToggleConfigAction extends Action2 {
2121

22-
constructor(private readonly section: string, title: string, order: number, mainWindowOnly: boolean) {
22+
constructor(private readonly section: string, title: string, description: string | ILocalizedString | undefined, order: number, mainWindowOnly: boolean) {
2323
const when = mainWindowOnly ? IsAuxiliaryWindowFocusedContext.toNegated() : ContextKeyExpr.true();
2424
super({
2525
id: `toggle.${section}`,
2626
title,
27+
metadata: description ? { description } : undefined,
2728
toggled: ContextKeyExpr.equals(`config.${section}`, true),
2829
menu: [
2930
{
@@ -51,13 +52,13 @@ class ToggleConfigAction extends Action2 {
5152

5253
registerAction2(class ToggleCommandCenter extends ToggleConfigAction {
5354
constructor() {
54-
super(LayoutSettings.COMMAND_CENTER, localize('toggle.commandCenter', 'Command Center'), 1, false);
55+
super(LayoutSettings.COMMAND_CENTER, localize('toggle.commandCenter', 'Command Center'), localize('toggle.commandCenterDescription', "Toggle visibility of the Command Center in title bar"), 1, false);
5556
}
5657
});
5758

5859
registerAction2(class ToggleLayoutControl extends ToggleConfigAction {
5960
constructor() {
60-
super('workbench.layoutControl.enabled', localize('toggle.layout', 'Layout Controls'), 2, true);
61+
super('workbench.layoutControl.enabled', localize('toggle.layout', 'Layout Controls'), localize('toggle.layoutDescription', "Toggle visibility of the Layout Controls in title bar"), 2, true);
6162
}
6263
});
6364

0 commit comments

Comments
 (0)