(options: {
contents?: string;
extension: string;
})
| 31 | export function initializeCommonWebApi() { |
| 32 | initializeCommonApi({ |
| 33 | async createTemporaryFile(options: { |
| 34 | contents?: string; |
| 35 | extension: string; |
| 36 | }): Promise<{ file: Uri } & IDisposable> { |
| 37 | const folder = workspace.workspaceFolders![0].uri; |
| 38 | const tmpDir = Uri.joinPath(folder, 'temp', 'testFiles'); |
| 39 | try { |
| 40 | await workspace.fs.createDirectory(tmpDir); |
| 41 | } catch { |
| 42 | // ignore if it exists.. |
| 43 | } |
| 44 | const extension = options.extension || '.py'; |
| 45 | const file = Uri.joinPath(tmpDir, `${generateUuid()}${extension}`); |
| 46 | const contents = options.contents || ''; |
| 47 | |
| 48 | await workspace.fs.writeFile(file, new TextEncoder().encode(contents)); |
| 49 | return { |
| 50 | file, |
| 51 | dispose: () => { |
| 52 | workspace.fs.delete(file).then(noop, noop); |
| 53 | } |
| 54 | }; |
| 55 | }, |
| 56 | async startJupyterServer(_options?: { |
| 57 | token?: string; |
| 58 | port?: number; |
nothing calls this directly
no test coverage detected