Skip to content

Commit

Permalink
refactor: optimize number of processFileChange() calls
Browse files Browse the repository at this point in the history
  • Loading branch information
sockmaster27 committed Jun 26, 2024
1 parent a6da55e commit 95e4dcc
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions test/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
}

Expand Down

0 comments on commit 95e4dcc

Please sign in to comment.