mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-13 15:35:20 +01:00
Dedupe strings in tf-idf index & include exactLabelMatch in runCommand in smoke tests (#195085)
This commit is contained in:
committed by
GitHub
parent
1523614834
commit
bd41b74fd1
@@ -286,10 +286,10 @@ export abstract class AbstractCommandsQuickAccessProvider extends PickerQuickAcc
|
||||
// TF-IDF string to be indexed
|
||||
private getTfIdfChunk({ label, commandAlias, commandDescription }: ICommandQuickPick) {
|
||||
let chunk = label;
|
||||
if (commandAlias) {
|
||||
if (commandAlias && commandAlias !== label) {
|
||||
chunk += ` - ${commandAlias}`;
|
||||
}
|
||||
if (commandDescription) {
|
||||
if (commandDescription && commandDescription.value !== label) {
|
||||
// If the original is the same as the value, don't add it
|
||||
chunk += ` - ${commandDescription.value === commandDescription.original ? commandDescription.value : `${commandDescription.value} (${commandDescription.original})`}`;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ export class Extensions extends Viewlet {
|
||||
}
|
||||
|
||||
async searchForExtension(id: string): Promise<any> {
|
||||
await this.commands.runCommand('workbench.extensions.action.focusExtensionsView');
|
||||
await this.commands.runCommand('Extensions: Focus on Extensions View', { exactLabelMatch: true });
|
||||
await this.code.waitForTypeInEditor('div.extensions-viewlet[id="workbench.view.extensions"] .monaco-editor textarea', `@id:${id}`);
|
||||
await this.code.waitForTextContent(`div.part.sidebar div.composite.title h2`, 'Extensions: Marketplace');
|
||||
|
||||
|
||||
@@ -170,9 +170,12 @@ export class QuickAccess {
|
||||
}
|
||||
}
|
||||
|
||||
async runCommand(commandId: string, keepOpen?: boolean): Promise<void> {
|
||||
async runCommand(commandId: string, options?: { keepOpen?: boolean; exactLabelMatch?: boolean }): Promise<void> {
|
||||
let retries = 0;
|
||||
|
||||
const keepOpen = options?.keepOpen;
|
||||
const exactLabelMatch = options?.exactLabelMatch;
|
||||
|
||||
while (++retries < 5) {
|
||||
|
||||
// open commands picker
|
||||
@@ -183,7 +186,7 @@ export class QuickAccess {
|
||||
|
||||
// Retry for as long as the command not found
|
||||
const text = await this.quickInput.waitForQuickInputElementText();
|
||||
if (text === 'No matching commands') {
|
||||
if (text === 'No matching commands' || (exactLabelMatch && text !== commandId)) {
|
||||
this.code.logger.log(`QuickAccess: No matching commands, will retry...`);
|
||||
await this.quickInput.closeQuickInput();
|
||||
await this.code.wait(1000);
|
||||
|
||||
@@ -35,7 +35,7 @@ export class Task {
|
||||
async assertTasks(filter: string, expected: ITaskConfigurationProperties[], type: 'run' | 'configure') {
|
||||
await this.code.dispatchKeybinding('right');
|
||||
await this.editors.saveOpenedFile();
|
||||
type === 'run' ? await this.quickaccess.runCommand('workbench.action.tasks.runTask', true) : await this.quickaccess.runCommand('workbench.action.tasks.configureTask', true);
|
||||
type === 'run' ? await this.quickaccess.runCommand('workbench.action.tasks.runTask', { keepOpen: true }) : await this.quickaccess.runCommand('workbench.action.tasks.configureTask', { keepOpen: true });
|
||||
if (expected.length === 0) {
|
||||
await this.quickinput.waitForQuickInputElements(e => e.length > 1 && e.every(label => label.trim() !== filter.trim()));
|
||||
} else {
|
||||
|
||||
@@ -80,7 +80,7 @@ export class Terminal {
|
||||
|
||||
async runCommand(commandId: TerminalCommandId, expectedLocation?: 'editor' | 'panel'): Promise<void> {
|
||||
const keepOpen = commandId === TerminalCommandId.Join;
|
||||
await this.quickaccess.runCommand(commandId, keepOpen);
|
||||
await this.quickaccess.runCommand(commandId, { keepOpen });
|
||||
if (keepOpen) {
|
||||
await this.code.dispatchKeybinding('enter');
|
||||
await this.quickinput.waitForQuickInputClosed();
|
||||
@@ -106,8 +106,8 @@ export class Terminal {
|
||||
}
|
||||
|
||||
async runCommandWithValue(commandId: TerminalCommandIdWithValue, value?: string, altKey?: boolean): Promise<void> {
|
||||
const shouldKeepOpen = !!value || commandId === TerminalCommandIdWithValue.NewWithProfile || commandId === TerminalCommandIdWithValue.Rename || (commandId === TerminalCommandIdWithValue.SelectDefaultProfile && value !== 'PowerShell');
|
||||
await this.quickaccess.runCommand(commandId, shouldKeepOpen);
|
||||
const keepOpen = !!value || commandId === TerminalCommandIdWithValue.NewWithProfile || commandId === TerminalCommandIdWithValue.Rename || (commandId === TerminalCommandIdWithValue.SelectDefaultProfile && value !== 'PowerShell');
|
||||
await this.quickaccess.runCommand(commandId, { keepOpen });
|
||||
// Running the command should hide the quick input in the following frame, this next wait
|
||||
// ensures that the quick input is opened again before proceeding to avoid a race condition
|
||||
// where the enter keybinding below would close the quick input if it's triggered before the
|
||||
|
||||
@@ -24,7 +24,7 @@ import { Localization } from './localization';
|
||||
import { Task } from './task';
|
||||
|
||||
export interface Commands {
|
||||
runCommand(command: string): Promise<any>;
|
||||
runCommand(command: string, options?: { exactLabelMatch?: boolean }): Promise<any>;
|
||||
}
|
||||
|
||||
export class Workbench {
|
||||
|
||||
Reference in New Issue
Block a user