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.ts21
1 files changed, 21 insertions, 0 deletions
diff --git a/editors/code/src/commands/join_lines.ts b/editors/code/src/commands/join_lines.ts
new file mode 100644
index 000000000..7ae7b9d76
--- /dev/null
+++ b/editors/code/src/commands/join_lines.ts
@@ -0,0 +1,21 @@
1import * as vscode from 'vscode';
2
3import { TextDocumentIdentifier, Range } from "vscode-languageclient";
4import { Server } from '../server';
5import { handle as applySourceChange, SourceChange } from './apply_source_change';
6
7interface JoinLinesParams {
8 textDocument: TextDocumentIdentifier;
9 range: Range;
10}
11
12export async function handle() {
13 let editor = vscode.window.activeTextEditor
14 if (editor == null || editor.document.languageId != "rust") return
15 let request: JoinLinesParams = {
16 textDocument: { uri: editor.document.uri.toString() },
17 range: Server.client.code2ProtocolConverter.asRange(editor.selection),
18 }
19 let change = await Server.client.sendRequest<SourceChange>("m/joinLines", request)
20 await applySourceChange(change)
21}