From df05d7e1e854b318fc74f33ca701ed521fd3a5ce Mon Sep 17 00:00:00 2001 From: eric thul Date: Sat, 19 Nov 2016 12:26:58 -0500 Subject: Always resolve on psc-ide rebuild failure The objective of enabling psc-ide is to obtain feedback immediately from the PureScript compiler. When the loader triggers an error to webpack, the bundle is invalidated and dependencies of the PureScript file that caused the error will be passed through the loader on the next successful rebuild. However, this behaviour adds time to the feedback loop. In order to reduce the time of the PureScript compiler feedback loop when in development, this commit always resolves the rebuild process with a success. Errors and warnings are still emitted, but the webpack bundle is not invalidated. This means that the loader will only be run for the current file being editted and the developer gets immediate feedback on success or failure when psc-ide is enabled. Resolves #76 --- src/PscIde.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/PscIde.js b/src/PscIde.js index c9d0cfa..b0b56a8 100644 --- a/src/PscIde.js +++ b/src/PscIde.js @@ -77,10 +77,7 @@ function connect(psModule) { if (!cache.ideServer && number === 9) { debug(error) - console.log( - 'failed to connect to or start psc-ide-server, ' + - 'full compilation will occur on rebuild' - ) + console.warn('Failed to connect to or start psc-ide-server. A full compilation will occur on rebuild'); return Promise.resolve(psModule) } @@ -133,9 +130,7 @@ function rebuild(psModule) { } if (res && !Array.isArray(res.result)) { - return res.resultType === 'success' - ? resolve(psModule) - : reject(new Error('psc-ide rebuild failed')) + return resolve(psModule); } Promise.map(res.result, (item, i) => { @@ -153,10 +148,10 @@ function rebuild(psModule) { })) .then(() => request({ command: 'load' })) .then(resolve) - .catch(() => reject(new Error('psc-ide rebuild failed'))) + .catch(() => resolve(psModule)) } cache.errors = compileMessages.join('\n') - reject(new Error('psc-ide rebuild failed')) + resolve(psModule); } else { cache.warnings = compileMessages.join('\n') resolve(psModule) -- cgit v1.2.3