MCPcopy
hub / github.com/microsoft/vscode / openFile

Method openFile

test/automation/src/quickaccess.ts:119–138  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

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;

Callers 4

setupFunction · 0.45
testHotExitFunction · 0.45
setupFunction · 0.45
setupFunction · 0.45

Calls 5

isAbsoluteFunction · 0.90
basenameFunction · 0.90
waitForEditorFocusMethod · 0.45

Tested by 4

setupFunction · 0.36
testHotExitFunction · 0.36
setupFunction · 0.36
setupFunction · 0.36