aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/commands/matching_brace.ts
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/src/commands/matching_brace.ts')
-rw-r--r--editors/code/src/commands/matching_brace.ts12
1 files changed, 6 insertions, 6 deletions
diff --git a/editors/code/src/commands/matching_brace.ts b/editors/code/src/commands/matching_brace.ts
index 59c253f88..7c58bb7e7 100644
--- a/editors/code/src/commands/matching_brace.ts
+++ b/editors/code/src/commands/matching_brace.ts
@@ -6,21 +6,21 @@ import { Ctx, Cmd } from '../ctx';
6export function matchingBrace(ctx: Ctx): Cmd { 6export function matchingBrace(ctx: Ctx): Cmd {
7 return async () => { 7 return async () => {
8 const editor = ctx.activeRustEditor; 8 const editor = ctx.activeRustEditor;
9 if (!editor) { 9 const client = ctx.client;
10 return; 10 if (!editor || !client) return;
11 } 11
12 const request: FindMatchingBraceParams = { 12 const request: FindMatchingBraceParams = {
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 ctx.client.code2ProtocolConverter.asPosition(s.active), 15 client.code2ProtocolConverter.asPosition(s.active),
16 ), 16 ),
17 }; 17 };
18 const response = await ctx.client.sendRequest<lc.Position[]>( 18 const response = await client.sendRequest<lc.Position[]>(
19 'rust-analyzer/findMatchingBrace', 19 'rust-analyzer/findMatchingBrace',
20 request, 20 request,
21 ); 21 );
22 editor.selections = editor.selections.map((sel, idx) => { 22 editor.selections = editor.selections.map((sel, idx) => {
23 const active = ctx.client.protocol2CodeConverter.asPosition( 23 const active = client.protocol2CodeConverter.asPosition(
24 response[idx], 24 response[idx],
25 ); 25 );
26 const anchor = sel.isEmpty ? active : sel.anchor; 26 const anchor = sel.isEmpty ? active : sel.anchor;