diff options
-rw-r--r-- | editors/code/src/commands/matching_brace.ts | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/editors/code/src/commands/matching_brace.ts b/editors/code/src/commands/matching_brace.ts index 7c58bb7e7..a60776e2d 100644 --- a/editors/code/src/commands/matching_brace.ts +++ b/editors/code/src/commands/matching_brace.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import * as vscode from 'vscode'; | 1 | import * as vscode from 'vscode'; |
2 | import * as lc from 'vscode-languageclient'; | 2 | import * as ra from '../rust-analyzer-api'; |
3 | 3 | ||
4 | import { Ctx, Cmd } from '../ctx'; | 4 | import { Ctx, Cmd } from '../ctx'; |
5 | 5 | ||
@@ -9,16 +9,12 @@ export function matchingBrace(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: FindMatchingBraceParams = { | 12 | const response = await client.sendRequest(ra.findMatchingBrace, { |
13 | textDocument: { uri: editor.document.uri.toString() }, | 13 | textDocument: { uri: editor.document.uri.toString() }, |
14 | offsets: editor.selections.map(s => | 14 | offsets: editor.selections.map(s => |
15 | client.code2ProtocolConverter.asPosition(s.active), | 15 | client.code2ProtocolConverter.asPosition(s.active), |
16 | ), | 16 | ), |
17 | }; | 17 | }); |
18 | const response = await client.sendRequest<lc.Position[]>( | ||
19 | 'rust-analyzer/findMatchingBrace', | ||
20 | request, | ||
21 | ); | ||
22 | editor.selections = editor.selections.map((sel, idx) => { | 18 | editor.selections = editor.selections.map((sel, idx) => { |
23 | const active = client.protocol2CodeConverter.asPosition( | 19 | const active = client.protocol2CodeConverter.asPosition( |
24 | response[idx], | 20 | response[idx], |
@@ -29,8 +25,3 @@ export function matchingBrace(ctx: Ctx): Cmd { | |||
29 | editor.revealRange(editor.selection); | 25 | editor.revealRange(editor.selection); |
30 | }; | 26 | }; |
31 | } | 27 | } |
32 | |||
33 | interface FindMatchingBraceParams { | ||
34 | textDocument: lc.TextDocumentIdentifier; | ||
35 | offsets: lc.Position[]; | ||
36 | } | ||