mirror of
https://github.com/Microsoft/vscode
synced 2024-10-05 19:02:54 +00:00
parent
68e491f99f
commit
2932ec095d
|
@ -39,7 +39,7 @@ export class QuickAccess {
|
|||
}
|
||||
}
|
||||
|
||||
async openFile(fileName: string): Promise<void> {
|
||||
async openQuickAccessAndWait(fileName: string, exactMatch?: boolean): Promise<void> {
|
||||
let retries = 0;
|
||||
let fileFound = false;
|
||||
while (++retries < 10) {
|
||||
|
@ -49,7 +49,7 @@ export class QuickAccess {
|
|||
|
||||
await this.quickInput.waitForQuickInputElements(names => {
|
||||
const name = names[0];
|
||||
if (name === fileName) {
|
||||
if (exactMatch && name === fileName) {
|
||||
fileFound = true;
|
||||
return true;
|
||||
}
|
||||
|
@ -59,7 +59,12 @@ export class QuickAccess {
|
|||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
if (!exactMatch) {
|
||||
fileFound = true;
|
||||
return !!name;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
if (!retry) {
|
||||
|
@ -73,6 +78,10 @@ export class QuickAccess {
|
|||
if (!fileFound) {
|
||||
throw new Error(`Quick open file search was unable to find '${fileName}' after 10 attempts, giving up.`);
|
||||
}
|
||||
}
|
||||
|
||||
async openFile(fileName: string): Promise<void> {
|
||||
await this.openQuickAccessAndWait(fileName, true);
|
||||
|
||||
await this.code.dispatchKeybinding('enter');
|
||||
await this.editors.waitForActiveTab(fileName);
|
||||
|
|
|
@ -88,7 +88,7 @@ export function setup(opts: minimist.ParsedArgs) {
|
|||
'jsconfig.json'
|
||||
];
|
||||
|
||||
await app.workbench.quickaccess.openQuickAccess('.js');
|
||||
await app.workbench.quickaccess.openQuickAccessAndWait('.js');
|
||||
await app.workbench.quickinput.waitForQuickInputElements(names => expectedNames.every(n => names.some(m => n === m)));
|
||||
await app.code.dispatchKeybinding('escape');
|
||||
});
|
||||
|
@ -101,7 +101,7 @@ export function setup(opts: minimist.ParsedArgs) {
|
|||
'package.json'
|
||||
];
|
||||
|
||||
await app.workbench.quickaccess.openQuickAccess('a.s');
|
||||
await app.workbench.quickaccess.openQuickAccessAndWait('a.s');
|
||||
await app.workbench.quickinput.waitForQuickInputElements(names => expectedNames.every(n => names.some(m => n === m)));
|
||||
await app.code.dispatchKeybinding('escape');
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue