J'ai deux fonctions: doAsyncStuff et doNextStep. Comment puis-je sécuriser doNextStep être exécutée qu'après doAsyncStuff est fini?
J'ai essayé quelque chose comme ça, mais il n'a pas aidé: doAsyncStuff().then(_ => doNextStep());
async function doAsyncStuff() {
if (vscode.workspace.workspaceFolders) {
vscode.workspace.workspaceFolders.forEach(async (e) => {
for (const [name, type] of await vscode.workspace.fs.readDirectory(e.uri)) {
console.log(name);
}
});
}
return true;
}
function doNextStep() {
console.log('next step');
}