MCPcopy Create free account
hub / github.com/microsoft/vscode-extension-samples / getOrCreateFile

Function getOrCreateFile

test-provider-sample/src/extension.ts:165–179  ·  view source on GitHub ↗
(controller: vscode.TestController, uri: vscode.Uri)

Source from the content-addressed store, hash-verified

163}
164
165function getOrCreateFile(controller: vscode.TestController, uri: vscode.Uri) {
166 const existing = controller.items.get(uri.toString());
167 if (existing) {
168 return { file: existing, data: testData.get(existing) as TestFile };
169 }
170
171 const file = controller.createTestItem(uri.toString(), uri.path.split('/').pop()!, uri);
172 controller.items.add(file);
173
174 const data = new TestFile();
175 testData.set(file, data);
176
177 file.canResolveChildren = true;
178 return { file, data };
179}
180
181function gatherTestItems(collection: vscode.TestItemCollection) {
182 const items: vscode.TestItem[] = [];

Callers 3

updateNodeForDocumentFunction · 0.85
findInitialFilesFunction · 0.85
startWatchingWorkspaceFunction · 0.85

Calls 3

addMethod · 0.80
setMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected