blob: 7952fb0c006ceba7691aaedbd38857908a25ceaf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
import { Range, TextDocumentIdentifier } from 'vscode-languageclient';
import { Ctx, Cmd } from '../ctx';
import {
handle as applySourceChange,
SourceChange,
} from './apply_source_change';
export function joinLines(ctx: Ctx): Cmd {
return async () => {
const editor = ctx.activeRustEditor;
if (!editor) {
return;
}
const request: JoinLinesParams = {
range: ctx.client.code2ProtocolConverter.asRange(editor.selection),
textDocument: { uri: editor.document.uri.toString() },
};
const change = await ctx.client.sendRequest<SourceChange>(
'rust-analyzer/joinLines',
request,
);
await applySourceChange(change);
}
}
interface JoinLinesParams {
textDocument: TextDocumentIdentifier;
range: Range;
}
|