aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/commands.ts
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/src/commands.ts')
-rw-r--r--editors/code/src/commands.ts6
1 files changed, 5 insertions, 1 deletions
diff --git a/editors/code/src/commands.ts b/editors/code/src/commands.ts
index cc90fe889..ad0b533b9 100644
--- a/editors/code/src/commands.ts
+++ b/editors/code/src/commands.ts
@@ -148,16 +148,20 @@ export function moveItem(ctx: Ctx, direction: ra.Direction): Cmd {
148 const client = ctx.client; 148 const client = ctx.client;
149 if (!editor || !client) return; 149 if (!editor || !client) return;
150 150
151 const edit: lc.TextDocumentEdit = await client.sendRequest(ra.moveItem, { 151 const edit = await client.sendRequest(ra.moveItem, {
152 range: client.code2ProtocolConverter.asRange(editor.selection), 152 range: client.code2ProtocolConverter.asRange(editor.selection),
153 textDocument: ctx.client.code2ProtocolConverter.asTextDocumentIdentifier(editor.document), 153 textDocument: ctx.client.code2ProtocolConverter.asTextDocumentIdentifier(editor.document),
154 direction 154 direction
155 }); 155 });
156 156
157 if(!edit) return;
158
157 await editor.edit((builder) => { 159 await editor.edit((builder) => {
158 client.protocol2CodeConverter.asTextEdits(edit.edits).forEach((edit: any) => { 160 client.protocol2CodeConverter.asTextEdits(edit.edits).forEach((edit: any) => {
159 builder.replace(edit.range, edit.newText); 161 builder.replace(edit.range, edit.newText);
160 }); 162 });
163 }).then(() => {
164 editor.selection = new vscode.Selection(editor.selection.end, editor.selection.end);
161 }); 165 });
162 }; 166 };
163} 167}