diff --git a/editors/code/src/commands.ts b/editors/code/src/commands.ts index ee8fa2eb51d..bb4d2151ad7 100644 --- a/editors/code/src/commands.ts +++ b/editors/code/src/commands.ts @@ -125,8 +125,9 @@ export function joinLines(ctx: Ctx): Cmd { editor.document ), }); - await editor.edit(async (builder) => { - (await client.protocol2CodeConverter.asTextEdits(items)).forEach((edit: any) => { + const textEdits = await client.protocol2CodeConverter.asTextEdits(items); + await editor.edit((builder) => { + textEdits.forEach((edit: any) => { builder.replace(edit.range, edit.newText); }); });