diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-10-09 07:16:36 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-10-09 07:16:36 +0100 |
commit | c9798c0e6da53c132021f03ac7a50ccd8714b371 (patch) | |
tree | 0d6d49b2eb40ad161a72adbfbf9874b64540bf74 /editors/code/src/commands/matching_brace.ts | |
parent | f4ad36e972989c3feed8671d6d6fca0aed37cd8f (diff) | |
parent | e26071d96e1ff56289213dbe78415f836de8a70e (diff) |
Merge #104
104: Add vscode extension to CI r=aochagavia a=DJMcNab
Note that this testing is only done on travis - we are only running formatting and linting, so feature parity on appveyor is not required.
CC @aochagavia.
Fixes? #100
Co-authored-by: Daniel McNab <[email protected]>
Diffstat (limited to 'editors/code/src/commands/matching_brace.ts')
-rw-r--r-- | editors/code/src/commands/matching_brace.ts | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/editors/code/src/commands/matching_brace.ts b/editors/code/src/commands/matching_brace.ts index a80446a8f..5e6638e82 100644 --- a/editors/code/src/commands/matching_brace.ts +++ b/editors/code/src/commands/matching_brace.ts | |||
@@ -10,16 +10,23 @@ interface FindMatchingBraceParams { | |||
10 | 10 | ||
11 | export async function handle() { | 11 | export async function handle() { |
12 | const editor = vscode.window.activeTextEditor; | 12 | const editor = vscode.window.activeTextEditor; |
13 | if (editor == null || editor.document.languageId !== 'rust') { return; } | 13 | if (editor == null || editor.document.languageId !== 'rust') { |
14 | return; | ||
15 | } | ||
14 | const request: FindMatchingBraceParams = { | 16 | const request: FindMatchingBraceParams = { |
15 | textDocument: { uri: editor.document.uri.toString() }, | 17 | textDocument: { uri: editor.document.uri.toString() }, |
16 | offsets: editor.selections.map((s) => { | 18 | offsets: editor.selections.map(s => { |
17 | return Server.client.code2ProtocolConverter.asPosition(s.active); | 19 | return Server.client.code2ProtocolConverter.asPosition(s.active); |
18 | }), | 20 | }) |
19 | }; | 21 | }; |
20 | const response = await Server.client.sendRequest<Position[]>('m/findMatchingBrace', request); | 22 | const response = await Server.client.sendRequest<Position[]>( |
23 | 'm/findMatchingBrace', | ||
24 | request | ||
25 | ); | ||
21 | editor.selections = editor.selections.map((sel, idx) => { | 26 | editor.selections = editor.selections.map((sel, idx) => { |
22 | const active = Server.client.protocol2CodeConverter.asPosition(response[idx]); | 27 | const active = Server.client.protocol2CodeConverter.asPosition( |
28 | response[idx] | ||
29 | ); | ||
23 | const anchor = sel.isEmpty ? active : sel.anchor; | 30 | const anchor = sel.isEmpty ? active : sel.anchor; |
24 | return new vscode.Selection(anchor, active); | 31 | return new vscode.Selection(anchor, active); |
25 | }); | 32 | }); |