aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/PscIde.js
diff options
context:
space:
mode:
authoreric thul <thul.eric@gmail.com>2017-02-25 09:55:18 -0500
committereric thul <thul.eric@gmail.com>2017-02-25 09:55:18 -0500
commit4305f5b0053d6fd2887b364c5da0a1ca6c06fc54 (patch)
tree541cfb21319f8cb6a751132ff0fdb09addfc000f /src/PscIde.js
parent03f52cb367cc8f1e57c515e4ac61c49cb72773eb (diff)
downloadpurs-loader-4305f5b0053d6fd2887b364c5da0a1ca6c06fc54.tar.gz
purs-loader-4305f5b0053d6fd2887b364c5da0a1ca6c06fc54.tar.zst
purs-loader-4305f5b0053d6fd2887b364c5da0a1ca6c06fc54.zip
Handle missing module and adding debugging
Diffstat (limited to 'src/PscIde.js')
-rw-r--r--src/PscIde.js23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/PscIde.js b/src/PscIde.js
index 8a0e823..b164dc2 100644
--- a/src/PscIde.js
+++ b/src/PscIde.js
@@ -63,15 +63,28 @@ function connect(psModule) {
63 63
64 const serverArgs = dargs(Object.assign({ 64 const serverArgs = dargs(Object.assign({
65 outputDirectory: options.output, 65 outputDirectory: options.output,
66 "_": options.src 66 '_': options.src
67 }, options.pscIdeServerArgs)) 67 }, options.pscIdeServerArgs))
68 68
69 debug('attempting to start psc-ide-server', serverArgs) 69 debug('attempting to start psc-ide-server', serverArgs)
70 70
71 const ideServer = cache.ideServer = spawn('psc-ide-server', serverArgs) 71 const ideServer = cache.ideServer = spawn('psc-ide-server', serverArgs)
72
73 ideServer.stdout.on('data', data => {
74 debug('psc-ide-server stdout: %s', data.toString());
75 });
76
72 ideServer.stderr.on('data', data => { 77 ideServer.stderr.on('data', data => {
73 debug(data.toString()) 78 debug('psc-ide-server stderr: %s', data.toString());
74 }) 79 });
80
81 ideServer.on('error', error => {
82 debug('psc-ide-server error: %o', error);
83 });
84
85 ideServer.on('close', (code, signal) => {
86 debug('psc-ide-server close: %s %s', code, signal);
87 });
75 88
76 return retryPromise((retry, number) => { 89 return retryPromise((retry, number) => {
77 return connect_().catch(error => { 90 return connect_().catch(error => {
@@ -150,7 +163,7 @@ function rebuild(psModule) {
150 debug('unknown module, attempting full recompile') 163 debug('unknown module, attempting full recompile')
151 return Psc.compile(psModule) 164 return Psc.compile(psModule)
152 .then(() => PsModuleMap.makeMap(options.src).then(map => { 165 .then(() => PsModuleMap.makeMap(options.src).then(map => {
153 debug('rebuilt module map'); 166 debug('rebuilt module map after unknown module forced a recompile');
154 cache.psModuleMap = map; 167 cache.psModuleMap = map;
155 })) 168 }))
156 .then(() => request({ command: 'load' })) 169 .then(() => request({ command: 'load' }))
@@ -172,6 +185,8 @@ function rebuild(psModule) {
172 }) 185 })
173 }) 186 })
174 187
188 debug('psc-ide-client stdin: %o', body);
189
175 ideClient.stdin.write(JSON.stringify(body)) 190 ideClient.stdin.write(JSON.stringify(body))
176 ideClient.stdin.write('\n') 191 ideClient.stdin.write('\n')
177 }) 192 })