aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/commands/matching_brace.ts
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-12-30 18:08:23 +0000
committerGitHub <[email protected]>2019-12-30 18:08:23 +0000
commit7c1634a9c2d76ea8c152c368775391090d62db8f (patch)
tree3879a92160f2313f54e738812d698d62e298f1a0 /editors/code/src/commands/matching_brace.ts
parentb42d3ee3cc22aaa892d15c4ba2219a3bc53907a1 (diff)
parent260df66b7742e76c76184388253552c5055b1945 (diff)
Merge #2691
2691: Cleanup imports r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
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}