From 90022ae41775ca9e896742f4029788c36a76b7f0 Mon Sep 17 00:00:00 2001 From: Stanislav Panferov Date: Mon, 14 Aug 2017 09:38:48 -0700 Subject: [PATCH] fix: delay sending diagnotics request It seems that it halts checker for some time and it cannot answer another requests. --- src/checker/checker.ts | 2 +- src/instance.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/checker/checker.ts b/src/checker/checker.ts index 76ff498..37e6396 100644 --- a/src/checker/checker.ts +++ b/src/checker/checker.ts @@ -132,7 +132,7 @@ export class Checker { } as RemoveFile.Request); } - getDiagnostics(): any { + getDiagnostics(): Promise { return this.req({ type: 'Diagnostics' } as Diagnostics.Request); diff --git a/src/instance.ts b/src/instance.ts index b844a99..769331e 100644 --- a/src/instance.ts +++ b/src/instance.ts @@ -458,7 +458,7 @@ function setupAfterCompile(compiler, instanceName, forkChecker = false) { }); const timeStart = +(new Date()); - const diag = instance.loaderConfig.transpileOnly + const diag = () => instance.loaderConfig.transpileOnly ? Promise.resolve() : instance.checker.getDiagnostics() .then(diags => { @@ -479,10 +479,10 @@ function setupAfterCompile(compiler, instanceName, forkChecker = false) { files .then(() => { if (asyncErrors) { - // Don't wait for diags in watch mode + diag(); // Don't wait for diags in watch mode return; } else { - return diag; + return diag(); } }) .then(() => callback())