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