diff options
author | Aleksey Kladov <[email protected]> | 2020-05-25 10:10:31 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-05-25 10:10:31 +0100 |
commit | 021b3da6721df7eaad2eb87024d2b0da28d60ade (patch) | |
tree | c3bc7d2329650fe25e419b91cf3fff05694ecfa2 /editors/code/src/commands/join_lines.ts | |
parent | 4a013ec62d2dfacaf6010b08c96947aa38481721 (diff) |
Flatten simple commands
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 | } | ||