Skip to content

Commit

Permalink
Avoids focusing view on find
Browse files Browse the repository at this point in the history
  • Loading branch information
eamodio committed Nov 18, 2021
1 parent ef71c18 commit c00fe93
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/views/viewBase.ts
Expand Up @@ -370,7 +370,7 @@ export abstract class ViewBase<
if (this.root != null) return find.call(this);

// If we have no root (e.g. never been initialized) force it so the tree will load properly
await this.show();
await this.show({ preserveFocus: true });
// Since we have to show the view, let the callstack unwind before we try to find the node
return new Promise<ViewNode | undefined>(resolve => setTimeout(() => resolve(find.call(this)), 0));
}
Expand Down Expand Up @@ -522,9 +522,9 @@ export abstract class ViewBase<
}

@log()
async show() {
async show(options?: { preserveFocus?: boolean }) {
try {
void (await commands.executeCommand(`${this.id}.focus`));
void (await commands.executeCommand(`${this.id}.focus`, options));
} catch (ex) {
Logger.error(ex);
}
Expand Down

0 comments on commit c00fe93

Please sign in to comment.