diff options
author | Edwin Cheng <[email protected]> | 2019-03-31 14:21:14 +0100 |
---|---|---|
committer | Edwin Cheng <[email protected]> | 2019-04-02 08:03:30 +0100 |
commit | c894a3e19b0e658622a03a7d0539a78a433b42ae (patch) | |
tree | 687f625980861712afb024aec8af4718c1c900a7 | |
parent | 6971c7f1185fb7c1c0ce5f19867b999de71b5937 (diff) |
Fix prettier error
-rw-r--r-- | editors/code/src/commands/cargo_watch.ts | 26 | ||||
-rw-r--r-- | editors/code/src/commands/runnables.ts | 8 | ||||
-rw-r--r-- | editors/code/src/commands/watch_status.ts | 17 | ||||
-rw-r--r-- | editors/code/src/extension.ts | 2 |
4 files changed, 31 insertions, 22 deletions
diff --git a/editors/code/src/commands/cargo_watch.ts b/editors/code/src/commands/cargo_watch.ts index c6ce6ba06..037f1e302 100644 --- a/editors/code/src/commands/cargo_watch.ts +++ b/editors/code/src/commands/cargo_watch.ts | |||
@@ -2,7 +2,7 @@ import * as child_process from 'child_process'; | |||
2 | import * as path from 'path'; | 2 | import * as path from 'path'; |
3 | import * as timers from 'timers'; | 3 | import * as timers from 'timers'; |
4 | import * as vscode from 'vscode'; | 4 | import * as vscode from 'vscode'; |
5 | import {StatusDisplay} from './watch_status'; | 5 | import { StatusDisplay } from './watch_status'; |
6 | 6 | ||
7 | export class CargoWatchProvider { | 7 | export class CargoWatchProvider { |
8 | private diagnosticCollection?: vscode.DiagnosticCollection; | 8 | private diagnosticCollection?: vscode.DiagnosticCollection; |
@@ -12,19 +12,22 @@ export class CargoWatchProvider { | |||
12 | 12 | ||
13 | public activate(subscriptions: vscode.Disposable[]) { | 13 | public activate(subscriptions: vscode.Disposable[]) { |
14 | subscriptions.push(this); | 14 | subscriptions.push(this); |
15 | this.diagnosticCollection = vscode.languages.createDiagnosticCollection('rustc'); | 15 | this.diagnosticCollection = vscode.languages.createDiagnosticCollection( |
16 | 'rustc' | ||
17 | ); | ||
16 | 18 | ||
17 | this.statusDisplay = new StatusDisplay(subscriptions); | 19 | this.statusDisplay = new StatusDisplay(subscriptions); |
18 | 20 | ||
19 | // Start the cargo watch with json message | 21 | // Start the cargo watch with json message |
20 | this.cargoProcess = child_process.spawn('cargo', | 22 | this.cargoProcess = child_process.spawn( |
21 | ['watch', '-x', '\"check --message-format json\"'], | 23 | 'cargo', |
24 | ['watch', '-x', '"check --message-format json"'], | ||
22 | { | 25 | { |
23 | // stdio: ['ignore', 'pipe', 'ignore'], | 26 | // stdio: ['ignore', 'pipe', 'ignore'], |
24 | shell: true, | 27 | shell: true, |
25 | cwd: vscode.workspace.rootPath, | 28 | cwd: vscode.workspace.rootPath |
26 | }); | 29 | } |
27 | 30 | ); | |
28 | 31 | ||
29 | this.cargoProcess.stdout.on('data', (s: string) => { | 32 | this.cargoProcess.stdout.on('data', (s: string) => { |
30 | this.processOutput(s); | 33 | this.processOutput(s); |
@@ -109,7 +112,9 @@ export class CargoWatchProvider { | |||
109 | 112 | ||
110 | const fileUrl = vscode.Uri.file(fileName!); | 113 | const fileUrl = vscode.Uri.file(fileName!); |
111 | 114 | ||
112 | const diagnostics: vscode.Diagnostic[] = [...(this.diagnosticCollection!.get(fileUrl) || [])]; | 115 | const diagnostics: vscode.Diagnostic[] = [ |
116 | ...(this.diagnosticCollection!.get(fileUrl) || []) | ||
117 | ]; | ||
113 | diagnostics.push(diagnostic); | 118 | diagnostics.push(diagnostic); |
114 | 119 | ||
115 | this.diagnosticCollection!.set(fileUrl, diagnostics); | 120 | this.diagnosticCollection!.set(fileUrl, diagnostics); |
@@ -129,5 +134,4 @@ export class CargoWatchProvider { | |||
129 | eolIndex = this.outBuffer.indexOf('\n'); | 134 | eolIndex = this.outBuffer.indexOf('\n'); |
130 | } | 135 | } |
131 | } | 136 | } |
132 | |||
133 | } | 137 | } |
diff --git a/editors/code/src/commands/runnables.ts b/editors/code/src/commands/runnables.ts index 0adb85d5f..7bba6f9cb 100644 --- a/editors/code/src/commands/runnables.ts +++ b/editors/code/src/commands/runnables.ts | |||
@@ -134,8 +134,9 @@ export async function handleSingle(runnable: Runnable) { | |||
134 | * provide inline diagnostics; the user is met with a series of dialog boxes | 134 | * provide inline diagnostics; the user is met with a series of dialog boxes |
135 | * that, when accepted, allow us to `cargo install cargo-watch` and then run it. | 135 | * that, when accepted, allow us to `cargo install cargo-watch` and then run it. |
136 | */ | 136 | */ |
137 | export async function interactivelyStartCargoWatch(context: vscode.ExtensionContext) { | 137 | export async function interactivelyStartCargoWatch( |
138 | 138 | context: vscode.ExtensionContext | |
139 | ) { | ||
139 | if (Server.config.enableCargoWatchOnStartup === 'disabled') { | 140 | if (Server.config.enableCargoWatchOnStartup === 'disabled') { |
140 | return; | 141 | return; |
141 | } | 142 | } |
@@ -195,7 +196,6 @@ export async function interactivelyStartCargoWatch(context: vscode.ExtensionCont | |||
195 | } | 196 | } |
196 | } | 197 | } |
197 | 198 | ||
198 | |||
199 | const validater = new CargoWatchProvider(); | 199 | const validater = new CargoWatchProvider(); |
200 | validater.activate(context.subscriptions); | 200 | validater.activate(context.subscriptions); |
201 | } | 201 | } |
diff --git a/editors/code/src/commands/watch_status.ts b/editors/code/src/commands/watch_status.ts index 0943e8533..1b0611ce3 100644 --- a/editors/code/src/commands/watch_status.ts +++ b/editors/code/src/commands/watch_status.ts | |||
@@ -9,15 +9,20 @@ export class StatusDisplay { | |||
9 | private timer?: NodeJS.Timeout; | 9 | private timer?: NodeJS.Timeout; |
10 | 10 | ||
11 | constructor(subscriptions: vscode.Disposable[]) { | 11 | constructor(subscriptions: vscode.Disposable[]) { |
12 | this.statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, 10); | 12 | this.statusBarItem = vscode.window.createStatusBarItem( |
13 | vscode.StatusBarAlignment.Left, | ||
14 | 10 | ||
15 | ); | ||
13 | subscriptions.push(this.statusBarItem); | 16 | subscriptions.push(this.statusBarItem); |
14 | this.statusBarItem.hide(); | 17 | this.statusBarItem.hide(); |
15 | } | 18 | } |
16 | 19 | ||
17 | public show() { | 20 | public show() { |
18 | this.timer = this.timer || setInterval(() => { | 21 | this.timer = |
19 | this.statusBarItem!.text = 'cargo check ' + this.frame(); | 22 | this.timer || |
20 | }, 300); | 23 | setInterval(() => { |
24 | this.statusBarItem!.text = 'cargo check ' + this.frame(); | ||
25 | }, 300); | ||
21 | 26 | ||
22 | this.statusBarItem!.show(); | 27 | this.statusBarItem!.show(); |
23 | } | 28 | } |
@@ -32,6 +37,6 @@ export class StatusDisplay { | |||
32 | } | 37 | } |
33 | 38 | ||
34 | private frame() { | 39 | private frame() { |
35 | return spinnerFrames[this.i = ++this.i % spinnerFrames.length]; | 40 | return spinnerFrames[(this.i = ++this.i % spinnerFrames.length)]; |
36 | } | 41 | } |
37 | } \ No newline at end of file | 42 | } |
diff --git a/editors/code/src/extension.ts b/editors/code/src/extension.ts index 5cbf285e5..ef83c0b8b 100644 --- a/editors/code/src/extension.ts +++ b/editors/code/src/extension.ts | |||
@@ -2,7 +2,7 @@ import * as vscode from 'vscode'; | |||
2 | import * as lc from 'vscode-languageclient'; | 2 | import * as lc from 'vscode-languageclient'; |
3 | 3 | ||
4 | import * as commands from './commands'; | 4 | import * as commands from './commands'; |
5 | import { interactivelyStartCargoWatch} from './commands/runnables'; | 5 | import { interactivelyStartCargoWatch } from './commands/runnables'; |
6 | import { SyntaxTreeContentProvider } from './commands/syntaxTree'; | 6 | import { SyntaxTreeContentProvider } from './commands/syntaxTree'; |
7 | import * as events from './events'; | 7 | import * as events from './events'; |
8 | import * as notifications from './notifications'; | 8 | import * as notifications from './notifications'; |