diff options
Diffstat (limited to 'editors/code/src/commands/matching_brace.ts')
-rw-r--r-- | editors/code/src/commands/matching_brace.ts | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/editors/code/src/commands/matching_brace.ts b/editors/code/src/commands/matching_brace.ts deleted file mode 100644 index a60776e2d..000000000 --- a/editors/code/src/commands/matching_brace.ts +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | import * as vscode from 'vscode'; | ||
2 | import * as ra from '../rust-analyzer-api'; | ||
3 | |||
4 | import { Ctx, Cmd } from '../ctx'; | ||
5 | |||
6 | export function matchingBrace(ctx: Ctx): Cmd { | ||
7 | return async () => { | ||
8 | const editor = ctx.activeRustEditor; | ||
9 | const client = ctx.client; | ||
10 | if (!editor || !client) return; | ||
11 | |||
12 | const response = await client.sendRequest(ra.findMatchingBrace, { | ||
13 | textDocument: { uri: editor.document.uri.toString() }, | ||
14 | offsets: editor.selections.map(s => | ||
15 | client.code2ProtocolConverter.asPosition(s.active), | ||
16 | ), | ||
17 | }); | ||
18 | editor.selections = editor.selections.map((sel, idx) => { | ||
19 | const active = client.protocol2CodeConverter.asPosition( | ||
20 | response[idx], | ||
21 | ); | ||
22 | const anchor = sel.isEmpty ? active : sel.anchor; | ||
23 | return new vscode.Selection(anchor, active); | ||
24 | }); | ||
25 | editor.revealRange(editor.selection); | ||
26 | }; | ||
27 | } | ||