What I'm doing is basically:
async function doItAll(ownEdits: Array<TextEdit>) {
const editor: TextEditor = await getEditor();
applyOwnChanges(editor, ownEdits);
await commands.executeCommand('editor.action.organizeImports',
editor.document.uri.path);
await editor.document.save();
}
It all works, but the save happens before organizeImports finishes and I end up with a dirty editor, when the imports get modified.
I tripple checked that I didn't forget the await keyword, yet it works like it wasn't there.
This may be a bug or I may be doing or expecting something wrong. Am I?