diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-10-09 22:37:31 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-10-09 22:37:31 +0100 |
commit | 3c41087bf83a4ffda87a7bee16d8eb31562bac23 (patch) | |
tree | 54c1381ec3d57cbd0722053900e02f3a7ad10cd2 /editors/code/src/commands/on_enter.ts | |
parent | 31c8ebb743572ef07ac4ca77ddd17eddbcf4b24c (diff) | |
parent | f2d719b24afd404dbaf26332ff314a6161c74b71 (diff) |
Merge #115
115: Format vscode extension and add npm run fix r=matklad a=aochagavia
Co-authored-by: Adolfo OchagavĂa <[email protected]>
Diffstat (limited to 'editors/code/src/commands/on_enter.ts')
-rw-r--r-- | editors/code/src/commands/on_enter.ts | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/editors/code/src/commands/on_enter.ts b/editors/code/src/commands/on_enter.ts index 2666797fe..fe6aca63d 100644 --- a/editors/code/src/commands/on_enter.ts +++ b/editors/code/src/commands/on_enter.ts | |||
@@ -1,7 +1,10 @@ | |||
1 | import * as vscode from 'vscode'; | 1 | import * as vscode from 'vscode'; |
2 | import * as lc from 'vscode-languageclient'; | 2 | import * as lc from 'vscode-languageclient'; |
3 | import { Server } from '../server'; | 3 | import { Server } from '../server'; |
4 | import { handle as applySourceChange, SourceChange } from './apply_source_change'; | 4 | import { |
5 | handle as applySourceChange, | ||
6 | SourceChange | ||
7 | } from './apply_source_change'; | ||
5 | 8 | ||
6 | interface OnEnterParams { | 9 | interface OnEnterParams { |
7 | textDocument: lc.TextDocumentIdentifier; | 10 | textDocument: lc.TextDocumentIdentifier; |
@@ -10,12 +13,18 @@ interface OnEnterParams { | |||
10 | 13 | ||
11 | export async function handle(event: { text: string }): Promise<boolean> { | 14 | export async function handle(event: { text: string }): Promise<boolean> { |
12 | const editor = vscode.window.activeTextEditor; | 15 | const editor = vscode.window.activeTextEditor; |
13 | if (editor == null || editor.document.languageId !== 'rust' || event.text !== '\n') { | 16 | if ( |
17 | editor == null || | ||
18 | editor.document.languageId !== 'rust' || | ||
19 | event.text !== '\n' | ||
20 | ) { | ||
14 | return false; | 21 | return false; |
15 | } | 22 | } |
16 | const request: OnEnterParams = { | 23 | const request: OnEnterParams = { |
17 | textDocument: { uri: editor.document.uri.toString() }, | 24 | textDocument: { uri: editor.document.uri.toString() }, |
18 | position: Server.client.code2ProtocolConverter.asPosition(editor.selection.active), | 25 | position: Server.client.code2ProtocolConverter.asPosition( |
26 | editor.selection.active | ||
27 | ) | ||
19 | }; | 28 | }; |
20 | const change = await Server.client.sendRequest<undefined | SourceChange>( | 29 | const change = await Server.client.sendRequest<undefined | SourceChange>( |
21 | 'm/onEnter', | 30 | 'm/onEnter', |
@@ -25,5 +34,5 @@ export async function handle(event: { text: string }): Promise<boolean> { | |||
25 | return false; | 34 | return false; |
26 | } | 35 | } |
27 | await applySourceChange(change); | 36 | await applySourceChange(change); |
28 | return true | 37 | return true; |
29 | } | 38 | } |