diff options
author | Veetaha <[email protected]> | 2020-02-24 22:54:50 +0000 |
---|---|---|
committer | Veetaha <[email protected]> | 2020-02-24 22:54:50 +0000 |
commit | 38d7945ec7d3522e09a105a92156d1aaf8651f46 (patch) | |
tree | 2923963e8ff511966fb7ade32329833a0b229317 /editors | |
parent | c9a2fa1835a9b91d7e9332f7eceb8c899c727d32 (diff) |
vscode: migrate join_lines to rust-analyzer-api.ts
Diffstat (limited to 'editors')
-rw-r--r-- | editors/code/src/commands/join_lines.ts | 17 |
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 @@ | |||
1 | import * as lc from 'vscode-languageclient'; | 1 | import * as ra from '../rust-analyzer-api'; |
2 | 2 | ||
3 | import { Ctx, Cmd } from '../ctx'; | 3 | import { Ctx, Cmd } from '../ctx'; |
4 | import { applySourceChange, SourceChange } from '../source_change'; | 4 | import { applySourceChange } from '../source_change'; |
5 | 5 | ||
6 | export function joinLines(ctx: Ctx): Cmd { | 6 | export 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 | |||
24 | interface JoinLinesParams { | ||
25 | textDocument: lc.TextDocumentIdentifier; | ||
26 | range: lc.Range; | ||
27 | } | ||