diff options
Diffstat (limited to 'editors/code/src/commands/join_lines.ts')
-rw-r--r-- | editors/code/src/commands/join_lines.ts | 22 |
1 files changed, 0 insertions, 22 deletions
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 @@ | |||
1 | import * as ra from '../rust-analyzer-api'; | ||
2 | import * as lc from 'vscode-languageclient'; | ||
3 | |||
4 | import { Ctx, Cmd } from '../ctx'; | ||
5 | |||
6 | export function joinLines(ctx: Ctx): Cmd { | ||
7 | return async () => { | ||
8 | const editor = ctx.activeRustEditor; | ||
9 | const client = ctx.client; | ||
10 | if (!editor || !client) return; | ||
11 | |||
12 | const items: lc.TextEdit[] = await client.sendRequest(ra.joinLines, { | ||
13 | ranges: editor.selections.map((it) => client.code2ProtocolConverter.asRange(it)), | ||
14 | textDocument: { uri: editor.document.uri.toString() }, | ||
15 | }); | ||
16 | editor.edit((builder) => { | ||
17 | client.protocol2CodeConverter.asTextEdits(items).forEach((edit) => { | ||
18 | builder.replace(edit.range, edit.newText); | ||
19 | }); | ||
20 | }); | ||
21 | }; | ||
22 | } | ||