diff --git a/front_end/panels/console/console-meta.ts b/front_end/panels/console/console-meta.ts index 078e2e9a07..7a541abfaa 100644 --- a/front_end/panels/console/console-meta.ts +++ b/front_end/panels/console/console-meta.ts @@ -17,6 +17,10 @@ const UIStrings = { *@description Title of an action that shows the console. */ showConsole: 'Show Console', + /** + *@description Title of an action that toggles the console. + */ + toggleConsole: 'Toggle Console', /** *@description Text to clear the console */ @@ -172,7 +176,7 @@ UI.ViewManager.registerViewExtension({ UI.ActionRegistration.registerActionExtension({ actionId: 'console.toggle', category: UI.ActionRegistration.ActionCategory.CONSOLE, - title: i18nLazyString(UIStrings.showConsole), + title: i18nLazyString(UIStrings.toggleConsole), async loadActionDelegate() { const Console = await loadConsoleModule(); return new Console.ConsoleView.ActionDelegate(); diff --git a/front_end/panels/settings/settings-meta.ts b/front_end/panels/settings/settings-meta.ts index 5d7a5617d5..a786d31be0 100644 --- a/front_end/panels/settings/settings-meta.ts +++ b/front_end/panels/settings/settings-meta.ts @@ -163,7 +163,7 @@ UI.ActionRegistration.registerActionExtension({ UI.ActionRegistration.registerActionExtension({ category: UI.ActionRegistration.ActionCategory.SETTINGS, actionId: 'settings.shortcuts', - title: i18nLazyString(UIStrings.shortcuts), + title: i18nLazyString(UIStrings.showShortcuts), async loadActionDelegate() { const Settings = await loadSettingsModule(); return new Settings.SettingsScreen.ActionDelegate(); diff --git a/front_end/ui/legacy/components/quick_open/CommandMenu.ts b/front_end/ui/legacy/components/quick_open/CommandMenu.ts index ea4c0f9b27..cc2f926910 100644 --- a/front_end/ui/legacy/components/quick_open/CommandMenu.ts +++ b/front_end/ui/legacy/components/quick_open/CommandMenu.ts @@ -269,9 +269,13 @@ export class CommandMenuProvider extends Provider { } for (const command of allCommands) { - if (command.available()) { - this.commands.push(command); + if (!command.available()) { + continue; } + if (this.commands.find(({title, category}) => title === command.title && category === command.category)) { + continue; + } + this.commands.push(command); } this.commands = this.commands.sort(commandComparator); diff --git a/test/e2e/helpers/settings-shortcuts-helpers.ts b/test/e2e/helpers/settings-shortcuts-helpers.ts index 88b8ee226a..a01a7f3520 100644 --- a/test/e2e/helpers/settings-shortcuts-helpers.ts +++ b/test/e2e/helpers/settings-shortcuts-helpers.ts @@ -29,7 +29,7 @@ export const SHORTCUT_CHORD_TIMEOUT = 1000; export let VS_CODE_SHORTCUTS_SHORTCUTS = ['CtrlKCtrlS']; export let VS_CODE_SETTINGS_SHORTCUTS = ['Shift?', 'Ctrl,']; -export let VS_CODE_SHORTCUTS_QUICK_OPEN_TEXT = 'ShortcutsCtrl + K Ctrl + SSettings'; +export let VS_CODE_SHORTCUTS_QUICK_OPEN_TEXT = 'Show ShortcutsCtrl + K Ctrl + SSettings'; export let VS_CODE_PAUSE_SHORTCUTS = ['Ctrl\\', 'F5', 'ShiftF5']; export let CONTROL_1_CONTROL_2_SHORTCUT_INPUTS_TEXT = ['Ctrl + 1', 'Ctrl + 2']; export let CONTROL_1_CONTROL_2_CHORD_INPUT_TEXT = ['Ctrl + 1 Ctrl + 2']; @@ -43,7 +43,7 @@ export let CONTROL_ALT_C_SHORTCUT_INPUT_TEXT = ['Ctrl + Alt + C']; if (platform === 'mac') { VS_CODE_SHORTCUTS_SHORTCUTS = ['⌘ K⌘ S']; VS_CODE_SETTINGS_SHORTCUTS = ['⇧ ?', '⌘ ,']; - VS_CODE_SHORTCUTS_QUICK_OPEN_TEXT = 'Shortcuts⌘ K ⌘ SSettings'; + VS_CODE_SHORTCUTS_QUICK_OPEN_TEXT = 'Show Shortcuts⌘ K ⌘ SSettings'; VS_CODE_PAUSE_SHORTCUTS = ['F5', '⇧ F5', '⌘ \\']; CONTROL_1_CONTROL_2_SHORTCUT_INPUTS_TEXT = ['Ctrl 1', 'Ctrl 2']; CONTROL_1_CONTROL_2_CHORD_INPUT_TEXT = ['Ctrl 1 Ctrl 2']; diff --git a/test/e2e/settings/shortcut_settings_test.ts b/test/e2e/settings/shortcut_settings_test.ts index 03f83a93a8..8a9246dd30 100644 --- a/test/e2e/settings/shortcut_settings_test.ts +++ b/test/e2e/settings/shortcut_settings_test.ts @@ -50,7 +50,7 @@ describe('Shortcuts Settings tab', async () => { await waitForVSCodeShortcutPreset(); - const shortcutsShortcuts = await shortcutsForAction('Shortcuts'); + const shortcutsShortcuts = await shortcutsForAction('Show Shortcuts'); const settingsShortcuts = await shortcutsForAction('Settings'); const pauseShortcuts = await shortcutsForAction('Pause script execution'); assert.deepStrictEqual(shortcutsShortcuts, VS_CODE_SHORTCUTS_SHORTCUTS); @@ -73,7 +73,7 @@ describe('Shortcuts Settings tab', async () => { await waitFor(QUICK_OPEN_SELECTOR); // make sure the command menu reflects the new shortcuts - await frontend.keyboard.type('Shortcuts'); + await frontend.keyboard.type('Show Shortcuts'); const shortcutsItemText = await getSelectedItemText(); assert.strictEqual(shortcutsItemText, VS_CODE_SHORTCUTS_QUICK_OPEN_TEXT); @@ -81,7 +81,7 @@ describe('Shortcuts Settings tab', async () => { it('should allow users to open the shortcut editor and view the current shortcut', async () => { await openSettingsTab('Shortcuts'); - await editShortcutListItem('Show Console'); + await editShortcutListItem('Toggle Console'); const shortcutInputsText = await shortcutInputValues(); assert.deepStrictEqual(shortcutInputsText, CONSOLE_SHORTCUT_INPUT_TEXT); @@ -91,7 +91,7 @@ describe('Shortcuts Settings tab', async () => { const {frontend} = getBrowserAndPages(); await openSettingsTab('Shortcuts'); - await editShortcutListItem('Show Console'); + await editShortcutListItem('Toggle Console'); await frontend.keyboard.down('Control'); await frontend.keyboard.press('1'); @@ -108,7 +108,7 @@ describe('Shortcuts Settings tab', async () => { await clickShortcutConfirmButton(); await waitForNoElementsWithTextContent(ADD_SHORTCUT_LINK_TEXT); - const shortcuts = await shortcutsForAction('Show Console'); + const shortcuts = await shortcutsForAction('Toggle Console'); assert.deepStrictEqual(shortcuts, CONTROL_1_CONTROL_2_SHORTCUT_DISPLAY_TEXT); }); @@ -150,7 +150,7 @@ describe('Shortcuts Settings tab', async () => { const {frontend} = getBrowserAndPages(); await openSettingsTab('Shortcuts'); - await editShortcutListItem('Show Console'); + await editShortcutListItem('Toggle Console'); await frontend.keyboard.down('Control'); await frontend.keyboard.press('1'); @@ -180,7 +180,7 @@ describe('Shortcuts Settings tab', async () => { await clickShortcutConfirmButton(); await waitForNoElementsWithTextContent(ADD_SHORTCUT_LINK_TEXT); - const shortcuts = await shortcutsForAction('Show Console'); + const shortcuts = await shortcutsForAction('Toggle Console'); assert.deepStrictEqual(shortcuts, CONSOLE_SHORTCUT_DISPLAY_TEXT); }); @@ -188,7 +188,7 @@ describe('Shortcuts Settings tab', async () => { const {frontend} = getBrowserAndPages(); await openSettingsTab('Shortcuts'); - await editShortcutListItem('Show Console'); + await editShortcutListItem('Toggle Console'); await frontend.keyboard.down('Control'); await frontend.keyboard.press('1'); @@ -205,7 +205,7 @@ describe('Shortcuts Settings tab', async () => { await clickShortcutCancelButton(); await waitForNoElementsWithTextContent(ADD_SHORTCUT_LINK_TEXT); - const shortcuts = await shortcutsForAction('Show Console'); + const shortcuts = await shortcutsForAction('Toggle Console'); assert.deepStrictEqual(shortcuts, CONSOLE_SHORTCUT_DISPLAY_TEXT); }); @@ -213,7 +213,7 @@ describe('Shortcuts Settings tab', async () => { const {frontend} = getBrowserAndPages(); await openSettingsTab('Shortcuts'); - await editShortcutListItem('Show Console'); + await editShortcutListItem('Toggle Console'); await frontend.keyboard.down('Control'); await frontend.keyboard.press('1'); @@ -227,7 +227,7 @@ describe('Shortcuts Settings tab', async () => { await clickShortcutConfirmButton(); await waitForNoElementsWithTextContent(ADD_SHORTCUT_LINK_TEXT); - const shortcuts = await shortcutsForAction('Show Console'); + const shortcuts = await shortcutsForAction('Toggle Console'); assert.deepStrictEqual(shortcuts, CONTROL_1_CONTROL_2_CHORD_DISPLAY_TEXT); }); @@ -235,7 +235,7 @@ describe('Shortcuts Settings tab', async () => { const {frontend} = getBrowserAndPages(); await openSettingsTab('Shortcuts'); - await editShortcutListItem('Show Console'); + await editShortcutListItem('Toggle Console'); await frontend.keyboard.down('Control'); await frontend.keyboard.down('Alt'); @@ -254,7 +254,7 @@ describe('Shortcuts Settings tab', async () => { const {frontend} = getBrowserAndPages(); await openSettingsTab('Shortcuts'); - await editShortcutListItem('Show Console'); + await editShortcutListItem('Toggle Console'); await frontend.keyboard.down('Control'); await frontend.keyboard.press('1'); @@ -269,7 +269,7 @@ describe('Shortcuts Settings tab', async () => { await clickShortcutConfirmButton(); await waitForNoElementsWithTextContent(ADD_SHORTCUT_LINK_TEXT); - const shortcuts = await shortcutsForAction('Show Console'); + const shortcuts = await shortcutsForAction('Toggle Console'); assert.deepStrictEqual(shortcuts, CONTROL_2_SHORTCUT_DISPLAY_TEXT); }); });