aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
Diffstat (limited to 'editors')
-rw-r--r--editors/code/src/commands/join_lines.ts17
1 files changed, 4 insertions, 13 deletions
diff --git a/editors/code/src/commands/join_lines.ts b/editors/code/src/commands/join_lines.ts
index 7b08c3255..de0614653 100644
--- a/editors/code/src/commands/join_lines.ts
+++ b/editors/code/src/commands/join_lines.ts
@@ -1,7 +1,7 @@
1import * as lc from 'vscode-languageclient'; 1import * as ra from '../rust-analyzer-api';
2 2
3import { Ctx, Cmd } from '../ctx'; 3import { Ctx, Cmd } from '../ctx';
4import { applySourceChange, SourceChange } from '../source_change'; 4import { applySourceChange } from '../source_change';
5 5
6export function joinLines(ctx: Ctx): Cmd { 6export function joinLines(ctx: Ctx): Cmd {
7 return async () => { 7 return async () => {
@@ -9,19 +9,10 @@ export function joinLines(ctx: Ctx): Cmd {
9 const client = ctx.client; 9 const client = ctx.client;
10 if (!editor || !client) return; 10 if (!editor || !client) return;
11 11
12 const request: JoinLinesParams = { 12 const change = await client.sendRequest(ra.joinLines, {
13 range: client.code2ProtocolConverter.asRange(editor.selection), 13 range: client.code2ProtocolConverter.asRange(editor.selection),
14 textDocument: { uri: editor.document.uri.toString() }, 14 textDocument: { uri: editor.document.uri.toString() },
15 }; 15 });
16 const change = await client.sendRequest<SourceChange>(
17 'rust-analyzer/joinLines',
18 request,
19 );
20 await applySourceChange(ctx, change); 16 await applySourceChange(ctx, change);
21 }; 17 };
22} 18}
23
24interface JoinLinesParams {
25 textDocument: lc.TextDocumentIdentifier;
26 range: lc.Range;
27}