aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/PscIde.js
diff options
context:
space:
mode:
authoreric thul <thul.eric@gmail.com>2016-11-19 13:12:54 -0500
committereric thul <thul.eric@gmail.com>2016-11-19 13:12:54 -0500
commit28124e28f18c5aae38e149a3fc9624b46a906281 (patch)
tree3fd97f9efa767dbf356f7cd1f079b1694ed49792 /src/PscIde.js
parent514ab14654d5809c2485455c875471328238d102 (diff)
downloadpurs-loader-28124e28f18c5aae38e149a3fc9624b46a906281.tar.gz
purs-loader-28124e28f18c5aae38e149a3fc9624b46a906281.tar.zst
purs-loader-28124e28f18c5aae38e149a3fc9624b46a906281.zip
PscIde full recompile on unknown module imports
Instead of forcing a recompile on an unknown value and on unknown module imports, opt to only recompile for unknown module imports. An unknown value may be a typo. Having a faster feedback loop in these cases seems ideal.
Diffstat (limited to 'src/PscIde.js')
-rw-r--r--src/PscIde.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/PscIde.js b/src/PscIde.js
index b0b56a8..2e105be 100644
--- a/src/PscIde.js
+++ b/src/PscIde.js
@@ -139,7 +139,13 @@ function rebuild(psModule) {
139 }) 139 })
140 .then(compileMessages => { 140 .then(compileMessages => {
141 if (res.resultType === 'error') { 141 if (res.resultType === 'error') {
142 if (res.result.some(item => item.errorCode === 'UnknownModule' || item.errorCode === 'UnknownName')) { 142 if (res.result.some(item => {
143 const isUnknownModule = item.errorCode === 'UnknownModule';
144
145 const isUnknownModuleImport = item.errorCode === 'UnknownName' && /Unknown module/.test(item.message);
146
147 return isUnknownModule || isUnknownModuleImport;
148 })) {
143 debug('unknown module, attempting full recompile') 149 debug('unknown module, attempting full recompile')
144 return Psc.compile(psModule) 150 return Psc.compile(psModule)
145 .then(() => PsModuleMap.makeMap(options.src).then(map => { 151 .then(() => PsModuleMap.makeMap(options.src).then(map => {