diff --git a/src/vs/platform/quickinput/browser/commandsQuickAccess.ts b/src/vs/platform/quickinput/browser/commandsQuickAccess.ts index 41ce48f93eb..e51f11116bb 100644 --- a/src/vs/platform/quickinput/browser/commandsQuickAccess.ts +++ b/src/vs/platform/quickinput/browser/commandsQuickAccess.ts @@ -61,6 +61,7 @@ export abstract class AbstractCommandsQuickAccessProvider extends PickerQuickAcc const labelHighlights = withNullAsUndefined(AbstractCommandsQuickAccessProvider.WORD_FILTER(filter, commandPick.label)); const aliasHighlights = commandPick.commandAlias ? withNullAsUndefined(AbstractCommandsQuickAccessProvider.WORD_FILTER(filter, commandPick.commandAlias)) : undefined; + // Add if matching in label or alias if (labelHighlights || aliasHighlights) { commandPick.highlights = { label: labelHighlights, @@ -69,6 +70,11 @@ export abstract class AbstractCommandsQuickAccessProvider extends PickerQuickAcc filteredCommandPicks.push(commandPick); } + + // Also add if we have a 100% command ID match + else if (filter === commandPick.commandId) { + filteredCommandPicks.push(commandPick); + } } // Add description to commands that have duplicate labels diff --git a/test/automation/src/quickinput.ts b/test/automation/src/quickinput.ts index 682d14eae7c..367f13ebb8c 100644 --- a/test/automation/src/quickinput.ts +++ b/test/automation/src/quickinput.ts @@ -9,7 +9,6 @@ export class QuickInput { static QUICK_INPUT = '.quick-input-widget'; static QUICK_INPUT_INPUT = `${QuickInput.QUICK_INPUT} .quick-input-box input`; - static QUICK_INPUT_FOCUSED_ELEMENT = `${QuickInput.QUICK_INPUT} .quick-open-tree .monaco-tree-row.focused .monaco-highlighted-label`; constructor(private code: Code) { } diff --git a/test/automation/src/quickopen.ts b/test/automation/src/quickopen.ts index b40afe76642..4852a79061c 100644 --- a/test/automation/src/quickopen.ts +++ b/test/automation/src/quickopen.ts @@ -8,12 +8,12 @@ import { Code } from './code'; export class QuickOpen { - static QUICK_OPEN = 'div.monaco-quick-open-widget'; - static QUICK_OPEN_HIDDEN = 'div.monaco-quick-open-widget[aria-hidden="true"]'; - static QUICK_OPEN_INPUT = `${QuickOpen.QUICK_OPEN} .quick-open-input input`; - static QUICK_OPEN_FOCUSED_ELEMENT = `${QuickOpen.QUICK_OPEN} .quick-open-tree .monaco-tree-row.focused .monaco-highlighted-label`; - static QUICK_OPEN_ENTRY_SELECTOR = 'div[aria-label="Quick Picker"] .monaco-tree-rows.show-twisties .monaco-tree-row .quick-open-entry'; - static QUICK_OPEN_ENTRY_LABEL_SELECTOR = 'div[aria-label="Quick Picker"] .monaco-tree-rows.show-twisties .monaco-tree-row .quick-open-entry .label-name'; + static QUICK_OPEN = '.quick-input-widget'; + static QUICK_OPEN_INPUT = `${QuickOpen.QUICK_OPEN} .quick-input-box input`; + static QUICK_OPEN_ROW = `${QuickOpen.QUICK_OPEN} .quick-input-list .monaco-list-row`; + static QUICK_OPEN_FOCUSED_ELEMENT = `${QuickOpen.QUICK_OPEN_ROW}.focused .monaco-highlighted-label`; + static QUICK_OPEN_ENTRY_LABEL = `${QuickOpen.QUICK_OPEN_ROW} .label-name`; + static QUICK_OPEN_ENTRY_LABEL_SPAN = `${QuickOpen.QUICK_OPEN_ROW} .monaco-highlighted-label span`; constructor(private code: Code, private editors: Editors) { } @@ -64,7 +64,7 @@ export class QuickOpen { } private async waitForQuickOpenClosed(): Promise { - await this.code.waitForElement(QuickOpen.QUICK_OPEN_HIDDEN); + await this.code.waitForElement(QuickOpen.QUICK_OPEN, r => !!r && r.attributes.style.indexOf('display: none;') !== -1); } async submit(text: string): Promise { @@ -74,26 +74,30 @@ export class QuickOpen { } async selectQuickOpenElement(index: number): Promise { - await this.waitForQuickOpenOpened(); - for (let from = 0; from < index; from++) { - await this.code.dispatchKeybinding('down'); - } + this.activateQuickOpenElement(index); await this.code.dispatchKeybinding('enter'); await this.waitForQuickOpenClosed(); } async waitForQuickOpenElements(accept: (names: string[]) => boolean): Promise { - await this.code.waitForElements(QuickOpen.QUICK_OPEN_ENTRY_LABEL_SELECTOR, false, els => accept(els.map(e => e.textContent))); + await this.code.waitForElements(QuickOpen.QUICK_OPEN_ENTRY_LABEL, false, els => accept(els.map(e => e.textContent))); } - async runCommand(command: string): Promise { - await this.openQuickOpen(`> ${command}`); + async runCommand(commandId: string): Promise { + await this.openQuickOpen(`>${commandId}`); // wait for best choice to be focused - await this.code.waitForTextContent(QuickOpen.QUICK_OPEN_FOCUSED_ELEMENT, command); + await this.code.waitForTextContent(QuickOpen.QUICK_OPEN_FOCUSED_ELEMENT); // wait and click on best choice - await this.code.waitAndClick(QuickOpen.QUICK_OPEN_FOCUSED_ELEMENT); + await this.selectQuickOpenElement(0); + } + + async activateQuickOpenElement(index: number): Promise { + await this.waitForQuickOpenOpened(); + for (let from = 0; from < index; from++) { + await this.code.dispatchKeybinding('down'); + } } async openQuickOutline(): Promise { @@ -106,7 +110,7 @@ export class QuickOpen { await this.code.dispatchKeybinding('ctrl+shift+o'); } - const text = await this.code.waitForTextContent('div[aria-label="Quick Picker"] .monaco-tree-rows.show-twisties div.monaco-tree-row .quick-open-entry .monaco-icon-label .label-name .monaco-highlighted-label span'); + const text = await this.code.waitForTextContent(QuickOpen.QUICK_OPEN_ENTRY_LABEL_SPAN); if (text !== 'No symbol information for the file') { return; diff --git a/test/automation/src/settings.ts b/test/automation/src/settings.ts index 537ec269d2e..de54d4fc6d8 100644 --- a/test/automation/src/settings.ts +++ b/test/automation/src/settings.ts @@ -32,6 +32,6 @@ export class SettingsEditor { } private async openSettings(): Promise { - await this.quickopen.runCommand('Preferences: Open Settings (JSON)'); + await this.quickopen.runCommand('workbench.action.openSettingsJson'); } } diff --git a/test/automation/src/terminal.ts b/test/automation/src/terminal.ts index 82b7d9151e5..0aa4ee46a75 100644 --- a/test/automation/src/terminal.ts +++ b/test/automation/src/terminal.ts @@ -15,7 +15,7 @@ export class Terminal { constructor(private code: Code, private quickopen: QuickOpen) { } async showTerminal(): Promise { - await this.quickopen.runCommand('View: Toggle Integrated Terminal'); + await this.quickopen.runCommand('workbench.action.terminal.toggleTerminal'); await this.code.waitForActiveElement(XTERM_TEXTAREA); await this.code.waitForTerminalBuffer(XTERM_SELECTOR, lines => lines.some(line => line.length > 0)); }