[QuickOpen] Don't show the same command (per category) twice.

- Rename "Show Console" action to "Toggle Console", since to
  better reflect what it does (and reduce confusion).
- Rename "Shortcuts" action to "Show Shortcuts" to be consistent
  with the command menu title for the view.

Fixed: chromium:1506565
Change-Id: Ieb6a2e270835effe1a020bd97a93c686550c8d88
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5094034
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
This commit is contained in:
Benedikt Meurer
2023-12-06 13:39:46 +00:00
committed by Devtools-frontend LUCI CQ
parent bf28323255
commit e7051ee02f
5 changed files with 28 additions and 20 deletions
+5 -1
View File
@@ -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();
+1 -1
View File
@@ -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();
@@ -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);
@@ -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'];
+14 -14
View File
@@ -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);
});
});