From 021b3da6721df7eaad2eb87024d2b0da28d60ade Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 25 May 2020 11:10:31 +0200 Subject: Flatten simple commands --- editors/code/src/commands/join_lines.ts | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 editors/code/src/commands/join_lines.ts (limited to 'editors/code/src/commands/join_lines.ts') diff --git a/editors/code/src/commands/join_lines.ts b/editors/code/src/commands/join_lines.ts deleted file mode 100644 index 0bf1ee6e6..000000000 --- a/editors/code/src/commands/join_lines.ts +++ /dev/null @@ -1,22 +0,0 @@ -import * as ra from '../rust-analyzer-api'; -import * as lc from 'vscode-languageclient'; - -import { Ctx, Cmd } from '../ctx'; - -export function joinLines(ctx: Ctx): Cmd { - return async () => { - const editor = ctx.activeRustEditor; - const client = ctx.client; - if (!editor || !client) return; - - const items: lc.TextEdit[] = await client.sendRequest(ra.joinLines, { - ranges: editor.selections.map((it) => client.code2ProtocolConverter.asRange(it)), - textDocument: { uri: editor.document.uri.toString() }, - }); - editor.edit((builder) => { - client.protocol2CodeConverter.asTextEdits(items).forEach((edit) => { - builder.replace(edit.range, edit.newText); - }); - }); - }; -} -- cgit v1.2.3