From c894a3e19b0e658622a03a7d0539a78a433b42ae Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Sun, 31 Mar 2019 21:21:14 +0800 Subject: Fix prettier error --- editors/code/src/commands/cargo_watch.ts | 26 +++++++++++++++----------- editors/code/src/commands/runnables.ts | 8 ++++---- editors/code/src/commands/watch_status.ts | 17 +++++++++++------ editors/code/src/extension.ts | 2 +- 4 files changed, 31 insertions(+), 22 deletions(-) (limited to 'editors') 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'; import * as path from 'path'; import * as timers from 'timers'; import * as vscode from 'vscode'; -import {StatusDisplay} from './watch_status'; +import { StatusDisplay } from './watch_status'; export class CargoWatchProvider { private diagnosticCollection?: vscode.DiagnosticCollection; @@ -12,19 +12,22 @@ export class CargoWatchProvider { public activate(subscriptions: vscode.Disposable[]) { subscriptions.push(this); - this.diagnosticCollection = vscode.languages.createDiagnosticCollection('rustc'); + this.diagnosticCollection = vscode.languages.createDiagnosticCollection( + 'rustc' + ); this.statusDisplay = new StatusDisplay(subscriptions); - // Start the cargo watch with json message - this.cargoProcess = child_process.spawn('cargo', - ['watch', '-x', '\"check --message-format json\"'], + // Start the cargo watch with json message + this.cargoProcess = child_process.spawn( + 'cargo', + ['watch', '-x', '"check --message-format json"'], { - // stdio: ['ignore', 'pipe', 'ignore'], + // stdio: ['ignore', 'pipe', 'ignore'], shell: true, - cwd: vscode.workspace.rootPath, - }); - + cwd: vscode.workspace.rootPath + } + ); this.cargoProcess.stdout.on('data', (s: string) => { this.processOutput(s); @@ -109,7 +112,9 @@ export class CargoWatchProvider { const fileUrl = vscode.Uri.file(fileName!); - const diagnostics: vscode.Diagnostic[] = [...(this.diagnosticCollection!.get(fileUrl) || [])]; + const diagnostics: vscode.Diagnostic[] = [ + ...(this.diagnosticCollection!.get(fileUrl) || []) + ]; diagnostics.push(diagnostic); this.diagnosticCollection!.set(fileUrl, diagnostics); @@ -129,5 +134,4 @@ export class CargoWatchProvider { eolIndex = this.outBuffer.indexOf('\n'); } } - } 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) { * provide inline diagnostics; the user is met with a series of dialog boxes * that, when accepted, allow us to `cargo install cargo-watch` and then run it. */ -export async function interactivelyStartCargoWatch(context: vscode.ExtensionContext) { - +export async function interactivelyStartCargoWatch( + context: vscode.ExtensionContext +) { if (Server.config.enableCargoWatchOnStartup === 'disabled') { return; } @@ -195,7 +196,6 @@ export async function interactivelyStartCargoWatch(context: vscode.ExtensionCont } } - const validater = new CargoWatchProvider(); - validater.activate(context.subscriptions); + validater.activate(context.subscriptions); } 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 { private timer?: NodeJS.Timeout; constructor(subscriptions: vscode.Disposable[]) { - this.statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, 10); + this.statusBarItem = vscode.window.createStatusBarItem( + vscode.StatusBarAlignment.Left, + 10 + ); subscriptions.push(this.statusBarItem); this.statusBarItem.hide(); } public show() { - this.timer = this.timer || setInterval(() => { - this.statusBarItem!.text = 'cargo check ' + this.frame(); - }, 300); + this.timer = + this.timer || + setInterval(() => { + this.statusBarItem!.text = 'cargo check ' + this.frame(); + }, 300); this.statusBarItem!.show(); } @@ -32,6 +37,6 @@ export class StatusDisplay { } private frame() { - return spinnerFrames[this.i = ++this.i % spinnerFrames.length]; + return spinnerFrames[(this.i = ++this.i % spinnerFrames.length)]; } -} \ No newline at end of file +} 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'; import * as lc from 'vscode-languageclient'; import * as commands from './commands'; -import { interactivelyStartCargoWatch} from './commands/runnables'; +import { interactivelyStartCargoWatch } from './commands/runnables'; import { SyntaxTreeContentProvider } from './commands/syntaxTree'; import * as events from './events'; import * as notifications from './notifications'; -- cgit v1.2.3