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