diff --git a/src/commands/buffers.ts b/src/commands/buffers.ts index b311e89..b7080e0 100644 --- a/src/commands/buffers.ts +++ b/src/commands/buffers.ts @@ -31,16 +31,13 @@ export async function apply_changes_to_buffer(path: string, controller: codemp.B ) locks.set(path, event.change.content); - if (!await editor.edit(editBuilder => { + let success = await editor.edit(editBuilder => { editBuilder .replace(range, event.change.content) - })) { - continue; - } - else { - controller.ack(event.version); - } + }); + if(success) controller.ack(event.version); locks.delete(path); + if(!success) continue; if (event.hash !== undefined) { if (codemp.hash(editor.document.getText()) !== event.hash) {