diff options
| author | Veetaha <gerzoh1@gmail.com> | 2020-02-25 00:55:13 +0200 |
|---|---|---|
| committer | Veetaha <gerzoh1@gmail.com> | 2020-02-25 00:55:13 +0200 |
| commit | 56d1ff65324d59623e8483c7cbf03672611cbcdf (patch) | |
| tree | a25ccd11fb9f7eecba583b1694e917f50fa0de89 /editors/code/src | |
| parent | 38d7945ec7d3522e09a105a92156d1aaf8651f46 (diff) | |
| download | rust-56d1ff65324d59623e8483c7cbf03672611cbcdf.tar.gz rust-56d1ff65324d59623e8483c7cbf03672611cbcdf.zip | |
vscode: migrate matching_brace to rust-analyzer-api.ts
Diffstat (limited to 'editors/code/src')
| -rw-r--r-- | editors/code/src/commands/matching_brace.ts | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/editors/code/src/commands/matching_brace.ts b/editors/code/src/commands/matching_brace.ts index 7c58bb7e720..a60776e2d4d 100644 --- a/editors/code/src/commands/matching_brace.ts +++ b/editors/code/src/commands/matching_brace.ts @@ -1,5 +1,5 @@ import * as vscode from 'vscode'; -import * as lc from 'vscode-languageclient'; +import * as ra from '../rust-analyzer-api'; import { Ctx, Cmd } from '../ctx'; @@ -9,16 +9,12 @@ export function matchingBrace(ctx: Ctx): Cmd { const client = ctx.client; if (!editor || !client) return; - const request: FindMatchingBraceParams = { + const response = await client.sendRequest(ra.findMatchingBrace, { textDocument: { uri: editor.document.uri.toString() }, offsets: editor.selections.map(s => client.code2ProtocolConverter.asPosition(s.active), ), - }; - const response = await client.sendRequest<lc.Position[]>( - 'rust-analyzer/findMatchingBrace', - request, - ); + }); editor.selections = editor.selections.map((sel, idx) => { const active = client.protocol2CodeConverter.asPosition( response[idx], @@ -29,8 +25,3 @@ export function matchingBrace(ctx: Ctx): Cmd { editor.revealRange(editor.selection); }; } - -interface FindMatchingBraceParams { - textDocument: lc.TextDocumentIdentifier; - offsets: lc.Position[]; -} |
