diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-12-30 18:08:23 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-12-30 18:08:23 +0000 |
commit | 7c1634a9c2d76ea8c152c368775391090d62db8f (patch) | |
tree | 3879a92160f2313f54e738812d698d62e298f1a0 /editors/code/src/commands/join_lines.ts | |
parent | b42d3ee3cc22aaa892d15c4ba2219a3bc53907a1 (diff) | |
parent | 260df66b7742e76c76184388253552c5055b1945 (diff) |
Merge #2691
2691: Cleanup imports r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'editors/code/src/commands/join_lines.ts')
-rw-r--r-- | editors/code/src/commands/join_lines.ts | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/editors/code/src/commands/join_lines.ts b/editors/code/src/commands/join_lines.ts index 134ddc801..f4f902cf9 100644 --- a/editors/code/src/commands/join_lines.ts +++ b/editors/code/src/commands/join_lines.ts | |||
@@ -1,29 +1,26 @@ | |||
1 | import * as vscode from 'vscode'; | 1 | import * as lc from 'vscode-languageclient'; |
2 | 2 | ||
3 | import { Range, TextDocumentIdentifier } from 'vscode-languageclient'; | 3 | import { Ctx, Cmd } from '../ctx'; |
4 | import { Server } from '../server'; | 4 | import { applySourceChange, SourceChange } from '../source_change'; |
5 | import { | ||
6 | handle as applySourceChange, | ||
7 | SourceChange, | ||
8 | } from './apply_source_change'; | ||
9 | 5 | ||
10 | interface JoinLinesParams { | 6 | export function joinLines(ctx: Ctx): Cmd { |
11 | textDocument: TextDocumentIdentifier; | 7 | return async () => { |
12 | range: Range; | 8 | const editor = ctx.activeRustEditor; |
13 | } | 9 | if (!editor) return; |
14 | 10 | ||
15 | export async function handle() { | 11 | const request: JoinLinesParams = { |
16 | const editor = vscode.window.activeTextEditor; | 12 | range: ctx.client.code2ProtocolConverter.asRange(editor.selection), |
17 | if (editor == null || editor.document.languageId !== 'rust') { | 13 | textDocument: { uri: editor.document.uri.toString() }, |
18 | return; | 14 | }; |
19 | } | 15 | const change = await ctx.client.sendRequest<SourceChange>( |
20 | const request: JoinLinesParams = { | 16 | 'rust-analyzer/joinLines', |
21 | range: Server.client.code2ProtocolConverter.asRange(editor.selection), | 17 | request, |
22 | textDocument: { uri: editor.document.uri.toString() }, | 18 | ); |
19 | await applySourceChange(ctx, change); | ||
23 | }; | 20 | }; |
24 | const change = await Server.client.sendRequest<SourceChange>( | 21 | } |
25 | 'rust-analyzer/joinLines', | 22 | |
26 | request, | 23 | interface JoinLinesParams { |
27 | ); | 24 | textDocument: lc.TextDocumentIdentifier; |
28 | await applySourceChange(change); | 25 | range: lc.Range; |
29 | } | 26 | } |