| 117 | } |
| 118 | |
| 119 | async openFile(path: string): Promise<void> { |
| 120 | if (!isAbsolute(path)) { |
| 121 | // we require absolute paths to get a single |
| 122 | // result back that is unique and avoid hitting |
| 123 | // the search process to reduce chances of |
| 124 | // search needing longer. |
| 125 | throw new Error('QuickAccess.openFile requires an absolute path'); |
| 126 | } |
| 127 | |
| 128 | const fileName = basename(path); |
| 129 | |
| 130 | // quick access shows files with the basename of the path |
| 131 | await this.openFileQuickAccessAndWait(path, basename(path)); |
| 132 | |
| 133 | // open first element |
| 134 | await this.quickInput.selectQuickInputElement(0); |
| 135 | |
| 136 | // wait for editor being focused |
| 137 | await this.editors.waitForEditorFocus(fileName); |
| 138 | } |
| 139 | |
| 140 | private async openQuickAccessWithRetry(kind: QuickAccessKind, value?: string): Promise<void> { |
| 141 | let retries = 0; |