diff options
Diffstat (limited to 'editors/code/src/commands/matching_brace.ts')
-rw-r--r-- | editors/code/src/commands/matching_brace.ts | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/editors/code/src/commands/matching_brace.ts b/editors/code/src/commands/matching_brace.ts index 572c15ce8..cf7f6bf8f 100644 --- a/editors/code/src/commands/matching_brace.ts +++ b/editors/code/src/commands/matching_brace.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import * as vscode from 'vscode'; | 1 | import * as vscode from 'vscode'; |
2 | 2 | ||
3 | import { TextDocumentIdentifier, Position } from "vscode-languageclient"; | 3 | import { Position, TextDocumentIdentifier } from 'vscode-languageclient'; |
4 | import { Server } from '../server'; | 4 | import { Server } from '../server'; |
5 | 5 | ||
6 | interface FindMatchingBraceParams { | 6 | interface FindMatchingBraceParams { |
@@ -9,19 +9,19 @@ interface FindMatchingBraceParams { | |||
9 | } | 9 | } |
10 | 10 | ||
11 | export async function handle() { | 11 | export async function handle() { |
12 | let 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') { return; } |
14 | let request: FindMatchingBraceParams = { | 14 | const request: FindMatchingBraceParams = { |
15 | textDocument: { uri: editor.document.uri.toString() }, | 15 | textDocument: { uri: editor.document.uri.toString() }, |
16 | offsets: editor.selections.map((s) => { | 16 | offsets: editor.selections.map((s) => { |
17 | return Server.client.code2ProtocolConverter.asPosition(s.active) | 17 | return Server.client.code2ProtocolConverter.asPosition(s.active); |
18 | }) | 18 | }), |
19 | } | 19 | }; |
20 | let response = await Server.client.sendRequest<Position[]>("m/findMatchingBrace", request) | 20 | const response = await Server.client.sendRequest<Position[]>('m/findMatchingBrace', request); |
21 | editor.selections = editor.selections.map((sel, idx) => { | 21 | editor.selections = editor.selections.map((sel, idx) => { |
22 | let active = Server.client.protocol2CodeConverter.asPosition(response[idx]) | 22 | const active = Server.client.protocol2CodeConverter.asPosition(response[idx]); |
23 | let anchor = sel.isEmpty ? active : sel.anchor | 23 | const anchor = sel.isEmpty ? active : sel.anchor; |
24 | return new vscode.Selection(anchor, active) | 24 | return new vscode.Selection(anchor, active); |
25 | }) | 25 | }); |
26 | editor.revealRange(editor.selection) | 26 | editor.revealRange(editor.selection); |
27 | }; | 27 | } |