From 37bf996e94e53758c6ba160551903973bdc92ae5 Mon Sep 17 00:00:00 2001 From: BeniBenj Date: Thu, 4 Apr 2024 11:25:51 +0200 Subject: [PATCH] Add descriptions for commands #209511 --- .../browser/actions/layoutActions.ts | 22 ++++++++++++------- .../workbench/browser/actions/listCommands.ts | 1 + .../browser/parts/titlebar/titlebarActions.ts | 9 ++++---- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/vs/workbench/browser/actions/layoutActions.ts b/src/vs/workbench/browser/actions/layoutActions.ts index 765693c16c8a0..77574a6338d79 100644 --- a/src/vs/workbench/browser/actions/layoutActions.ts +++ b/src/vs/workbench/browser/actions/layoutActions.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { localize, localize2 } from 'vs/nls'; +import { ILocalizedString, localize, localize2 } from 'vs/nls'; import { MenuId, MenuRegistry, registerAction2, Action2 } from 'vs/platform/actions/common/actions'; import { Categories } from 'vs/platform/action/common/actionCommonCategories'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; @@ -447,12 +447,13 @@ registerAction2(ToggleStatusbarVisibilityAction); abstract class AbstractSetShowTabsAction extends Action2 { - constructor(private readonly settingName: string, private readonly value: string, title: ICommandActionTitle, id: string, precondition: ContextKeyExpression) { + constructor(private readonly settingName: string, private readonly value: string, title: ICommandActionTitle, id: string, precondition: ContextKeyExpression, description: string | ILocalizedString | undefined) { super({ id, title, category: Categories.View, precondition, + metadata: description ? { description } : undefined, f1: true }); } @@ -472,7 +473,7 @@ export class HideEditorTabsAction extends AbstractSetShowTabsAction { constructor() { const precondition = ContextKeyExpr.and(ContextKeyExpr.equals(`config.${LayoutSettings.EDITOR_TABS_MODE}`, EditorTabsMode.NONE).negate(), InEditorZenModeContext.negate())!; const title = localize2('hideEditorTabs', 'Hide Editor Tabs'); - super(LayoutSettings.EDITOR_TABS_MODE, EditorTabsMode.NONE, title, HideEditorTabsAction.ID, precondition); + super(LayoutSettings.EDITOR_TABS_MODE, EditorTabsMode.NONE, title, HideEditorTabsAction.ID, precondition, localize2('hideEditorTabsDescription', "Hide Tab Bar")); } } @@ -483,7 +484,7 @@ export class ZenHideEditorTabsAction extends AbstractSetShowTabsAction { constructor() { const precondition = ContextKeyExpr.and(ContextKeyExpr.equals(`config.${ZenModeSettings.SHOW_TABS}`, EditorTabsMode.NONE).negate(), InEditorZenModeContext)!; const title = localize2('hideEditorTabsZenMode', 'Hide Editor Tabs in Zen Mode'); - super(ZenModeSettings.SHOW_TABS, EditorTabsMode.NONE, title, ZenHideEditorTabsAction.ID, precondition); + super(ZenModeSettings.SHOW_TABS, EditorTabsMode.NONE, title, ZenHideEditorTabsAction.ID, precondition, localize2('hideEditorTabsZenModeDescription', "Hide Tab Bar in Zen Mode")); } } @@ -497,7 +498,7 @@ export class ShowMultipleEditorTabsAction extends AbstractSetShowTabsAction { const precondition = ContextKeyExpr.and(ContextKeyExpr.equals(`config.${LayoutSettings.EDITOR_TABS_MODE}`, EditorTabsMode.MULTIPLE).negate(), InEditorZenModeContext.negate())!; const title = localize2('showMultipleEditorTabs', 'Show Multiple Editor Tabs'); - super(LayoutSettings.EDITOR_TABS_MODE, EditorTabsMode.MULTIPLE, title, ShowMultipleEditorTabsAction.ID, precondition); + super(LayoutSettings.EDITOR_TABS_MODE, EditorTabsMode.MULTIPLE, title, ShowMultipleEditorTabsAction.ID, precondition, localize2('showMultipleEditorTabsDescription', "Show Tab Bar with multiple tabs")); } } @@ -509,7 +510,7 @@ export class ZenShowMultipleEditorTabsAction extends AbstractSetShowTabsAction { const precondition = ContextKeyExpr.and(ContextKeyExpr.equals(`config.${ZenModeSettings.SHOW_TABS}`, EditorTabsMode.MULTIPLE).negate(), InEditorZenModeContext)!; const title = localize2('showMultipleEditorTabsZenMode', 'Show Multiple Editor Tabs in Zen Mode'); - super(ZenModeSettings.SHOW_TABS, EditorTabsMode.MULTIPLE, title, ZenShowMultipleEditorTabsAction.ID, precondition); + super(ZenModeSettings.SHOW_TABS, EditorTabsMode.MULTIPLE, title, ZenShowMultipleEditorTabsAction.ID, precondition, localize2('showMultipleEditorTabsZenModeDescription', "Show Tab Bar in Zen Mode")); } } @@ -523,7 +524,7 @@ export class ShowSingleEditorTabAction extends AbstractSetShowTabsAction { const precondition = ContextKeyExpr.and(ContextKeyExpr.equals(`config.${LayoutSettings.EDITOR_TABS_MODE}`, EditorTabsMode.SINGLE).negate(), InEditorZenModeContext.negate())!; const title = localize2('showSingleEditorTab', 'Show Single Editor Tab'); - super(LayoutSettings.EDITOR_TABS_MODE, EditorTabsMode.SINGLE, title, ShowSingleEditorTabAction.ID, precondition); + super(LayoutSettings.EDITOR_TABS_MODE, EditorTabsMode.SINGLE, title, ShowSingleEditorTabAction.ID, precondition, localize2('showSingleEditorTabDescription', "Show Tab Bar with one Tab")); } } @@ -535,7 +536,7 @@ export class ZenShowSingleEditorTabAction extends AbstractSetShowTabsAction { const precondition = ContextKeyExpr.and(ContextKeyExpr.equals(`config.${ZenModeSettings.SHOW_TABS}`, EditorTabsMode.SINGLE).negate(), InEditorZenModeContext)!; const title = localize2('showSingleEditorTabZenMode', 'Show Single Editor Tab in Zen Mode'); - super(ZenModeSettings.SHOW_TABS, EditorTabsMode.SINGLE, title, ZenShowSingleEditorTabAction.ID, precondition); + super(ZenModeSettings.SHOW_TABS, EditorTabsMode.SINGLE, title, ZenShowSingleEditorTabAction.ID, precondition, localize2('showSingleEditorTabZenModeDescription', "Show Tab Bar in Zen Mode with one Tab")); } } @@ -576,6 +577,7 @@ export class EditorActionsTitleBarAction extends Action2 { title: localize2('moveEditorActionsToTitleBar', "Move Editor Actions to Title Bar"), category: Categories.View, precondition: ContextKeyExpr.equals(`config.${LayoutSettings.EDITOR_ACTIONS_LOCATION}`, EditorActionsLocation.TITLEBAR).negate(), + metadata: { description: localize2('moveEditorActionsToTitleBarDescription', "Move Editor Actions from the tab bar to the title bar") }, f1: true }); } @@ -602,6 +604,7 @@ export class EditorActionsDefaultAction extends Action2 { ContextKeyExpr.equals(`config.${LayoutSettings.EDITOR_ACTIONS_LOCATION}`, EditorActionsLocation.DEFAULT).negate(), ContextKeyExpr.equals(`config.${LayoutSettings.EDITOR_TABS_MODE}`, EditorTabsMode.NONE).negate(), ), + metadata: { description: localize2('moveEditorActionsToTabBarDescription', "Move Editor Actions from the title bar to the tab bar") }, f1: true }); } @@ -625,6 +628,7 @@ export class HideEditorActionsAction extends Action2 { title: localize2('hideEditorActons', "Hide Editor Actions"), category: Categories.View, precondition: ContextKeyExpr.equals(`config.${LayoutSettings.EDITOR_ACTIONS_LOCATION}`, EditorActionsLocation.HIDDEN).negate(), + metadata: { description: localize2('hideEditorActonsDescription', "Hide Editor Actions in the tab and title bar") }, f1: true }); } @@ -648,6 +652,7 @@ export class ShowEditorActionsAction extends Action2 { title: localize2('showEditorActons', "Show Editor Actions"), category: Categories.View, precondition: ContextKeyExpr.equals(`config.${LayoutSettings.EDITOR_ACTIONS_LOCATION}`, EditorActionsLocation.HIDDEN), + metadata: { description: localize2('showEditorActonsDescription', "Make Editor Actions visible.") }, f1: true }); } @@ -678,6 +683,7 @@ registerAction2(class extends Action2 { title: localize2('toggleSeparatePinnedEditorTabs', "Separate Pinned Editor Tabs"), category: Categories.View, precondition: ContextKeyExpr.equals(`config.${LayoutSettings.EDITOR_TABS_MODE}`, EditorTabsMode.MULTIPLE), + metadata: { description: localize2('toggleSeparatePinnedEditorTabsDescription', "Toggle whether pinned editor tabs are shown on a separate row above unpinned tabs.") }, f1: true }); } diff --git a/src/vs/workbench/browser/actions/listCommands.ts b/src/vs/workbench/browser/actions/listCommands.ts index dffef61a01569..41fce8a721b59 100644 --- a/src/vs/workbench/browser/actions/listCommands.ts +++ b/src/vs/workbench/browser/actions/listCommands.ts @@ -917,6 +917,7 @@ registerAction2(class ToggleStickyScroll extends Action2 { mnemonicTitle: localize({ key: 'mitoggleTreeStickyScroll', comment: ['&& denotes a mnemonic'] }, "&&Toggle Tree Sticky Scroll"), }, category: 'View', + metadata: { description: localize('toggleTreeStickyScrollDescription', "Toggles Sticky Scroll widget at the top of tree structures such as the File Explorer and Debug variables View.") }, f1: true }); } diff --git a/src/vs/workbench/browser/parts/titlebar/titlebarActions.ts b/src/vs/workbench/browser/parts/titlebar/titlebarActions.ts index 632bf55e2e232..16832936d7cb1 100644 --- a/src/vs/workbench/browser/parts/titlebar/titlebarActions.ts +++ b/src/vs/workbench/browser/parts/titlebar/titlebarActions.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { localize, localize2 } from 'vs/nls'; +import { ILocalizedString, localize, localize2 } from 'vs/nls'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage'; @@ -19,11 +19,12 @@ import { CustomTitleBarVisibility, TitleBarSetting, TitlebarStyle } from 'vs/pla class ToggleConfigAction extends Action2 { - constructor(private readonly section: string, title: string, order: number, mainWindowOnly: boolean) { + constructor(private readonly section: string, title: string, description: string | ILocalizedString | undefined, order: number, mainWindowOnly: boolean) { const when = mainWindowOnly ? IsAuxiliaryWindowFocusedContext.toNegated() : ContextKeyExpr.true(); super({ id: `toggle.${section}`, title, + metadata: description ? { description } : undefined, toggled: ContextKeyExpr.equals(`config.${section}`, true), menu: [ { @@ -51,13 +52,13 @@ class ToggleConfigAction extends Action2 { registerAction2(class ToggleCommandCenter extends ToggleConfigAction { constructor() { - super(LayoutSettings.COMMAND_CENTER, localize('toggle.commandCenter', 'Command Center'), 1, false); + super(LayoutSettings.COMMAND_CENTER, localize('toggle.commandCenter', 'Command Center'), localize('toggle.commandCenterDescription', "Toggle visibility of the Command Center in title bar"), 1, false); } }); registerAction2(class ToggleLayoutControl extends ToggleConfigAction { constructor() { - super('workbench.layoutControl.enabled', localize('toggle.layout', 'Layout Controls'), 2, true); + super('workbench.layoutControl.enabled', localize('toggle.layout', 'Layout Controls'), localize('toggle.layoutDescription', "Toggle visibility of the Layout Controls in title bar"), 2, true); } });