diff options
Diffstat (limited to 'editors/code/src/commands/on_enter.ts')
-rw-r--r-- | editors/code/src/commands/on_enter.ts | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/editors/code/src/commands/on_enter.ts b/editors/code/src/commands/on_enter.ts index 25eaebcbe..285849db7 100644 --- a/editors/code/src/commands/on_enter.ts +++ b/editors/code/src/commands/on_enter.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import * as vscode from 'vscode'; | 1 | import * as vscode from 'vscode'; |
2 | import * as lc from 'vscode-languageclient'; | 2 | import * as ra from '../rust-analyzer-api'; |
3 | 3 | ||
4 | import { applySourceChange, SourceChange } from '../source_change'; | 4 | import { applySourceChange } from '../source_change'; |
5 | import { Cmd, Ctx } from '../ctx'; | 5 | import { Cmd, Ctx } from '../ctx'; |
6 | 6 | ||
7 | async function handleKeypress(ctx: Ctx) { | 7 | async function handleKeypress(ctx: Ctx) { |
@@ -10,16 +10,15 @@ async function handleKeypress(ctx: Ctx) { | |||
10 | 10 | ||
11 | if (!editor || !client) return false; | 11 | if (!editor || !client) return false; |
12 | 12 | ||
13 | const request: lc.TextDocumentPositionParams = { | 13 | const change = await client.sendRequest(ra.onEnter, { |
14 | textDocument: { uri: editor.document.uri.toString() }, | 14 | textDocument: { uri: editor.document.uri.toString() }, |
15 | position: client.code2ProtocolConverter.asPosition( | 15 | position: client.code2ProtocolConverter.asPosition( |
16 | editor.selection.active, | 16 | editor.selection.active, |
17 | ), | 17 | ), |
18 | }; | 18 | }).catch(_error => { |
19 | const change = await client.sendRequest<undefined | SourceChange>( | 19 | // client.logFailedRequest(OnEnterRequest.type, error); |
20 | 'rust-analyzer/onEnter', | 20 | return null; |
21 | request, | 21 | }); |
22 | ); | ||
23 | if (!change) return false; | 22 | if (!change) return false; |
24 | 23 | ||
25 | await applySourceChange(ctx, change); | 24 | await applySourceChange(ctx, change); |