From 95e4dcc1472604c533eabd3fcee5fcf70192bf9e Mon Sep 17 00:00:00 2001 From: sockmaster27 <61235930+sockmaster27@users.noreply.github.com> Date: Wed, 26 Jun 2024 15:21:09 +0200 Subject: [PATCH] refactor: optimize number of `processFileChange()` calls --- test/src/util.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/src/util.ts b/test/src/util.ts index 1936550..b041d4c 100644 --- a/test/src/util.ts +++ b/test/src/util.ts @@ -74,10 +74,9 @@ async function copyWorkspace(testWorkspaceName: string) { name => !namesToKeep.includes(name) && extensionsToDelete.includes(name.split('.').at(-1)), ) const urisToDelete = namesToDelete.map(name => vscode.Uri.joinPath(uri, name)) - await Promise.allSettled(urisToDelete.map(deleteFile)) + await Promise.allSettled(urisToDelete.map(uri => vscode.workspace.fs.delete(uri))) } await clearDir(activeWorkspaceUri) - await processFileChange() const testWorkspacePath = path.resolve(__dirname, '../testWorkspaces', testWorkspaceName) @@ -147,7 +146,7 @@ export async function copyDirContents(from: vscode.Uri, to: vscode.Uri) { const uris = names.map(name => ({ from: vscode.Uri.joinPath(from, name), to: vscode.Uri.joinPath(to, name) })) - await Promise.allSettled(uris.map(({ from, to }) => copyFile(from, to))) + await Promise.allSettled(uris.map(({ from, to }) => vscode.workspace.fs.copy(from, to, { overwrite: true }))) await processFileChange() }