@@ -232,7 +232,7 @@ export default class AutoLanguageClient {
232
232
} finally {
233
233
startingSignal && startingSignal . dispose ( ) ;
234
234
}
235
-
235
+ this . captureServerErrors ( process , projectPath ) ;
236
236
const connection = new ls . LanguageClientConnection ( this . createRpcConnection ( process ) , this . logger ) ;
237
237
this . preInitialization ( connection ) ;
238
238
const initializeParams = this . getInitializeParams ( projectPath , process ) ;
@@ -255,13 +255,13 @@ export default class AutoLanguageClient {
255
255
return newServer ;
256
256
}
257
257
258
- captureServerErrors ( childProcess : child_process$ChildProcess ) : void {
258
+ captureServerErrors ( childProcess : child_process$ChildProcess , projectPath : string ) : void {
259
259
childProcess . on ( 'error' , err => this . handleSpawnFailure ( err ) ) ;
260
- childProcess . on ( 'exit' , ( code , signal ) => this . logger . debug ( `exited code ${ code } ` ) ) ;
260
+ childProcess . on ( 'exit' , ( code , signal ) => code !== null && this . logger . debug ( `exit code: ${ code } ` ) ) ;
261
261
childProcess . stderr . setEncoding ( 'utf8' ) ;
262
262
childProcess . stderr . on ( 'data' , ( chunk : Buffer ) => {
263
263
const errorString = chunk . toString ( ) ;
264
- this . logger . warn ( 'stderr' , errorString ) ;
264
+ this . handleServerStderr ( errorString , projectPath ) ;
265
265
// Keep the last 5 lines for packages to use in messages
266
266
this . processStdErr = ( this . processStdErr + errorString )
267
267
. split ( '\n' )
@@ -572,4 +572,12 @@ export default class AutoLanguageClient {
572
572
filterChangeWatchedFiles ( filePath : string ) : boolean {
573
573
return true ;
574
574
}
575
+
576
+ /**
577
+ * Called on language server stderr output.
578
+ * @param stderr a chunk of stderr from a language server instance
579
+ */
580
+ handleServerStderr ( stderr : string , projectPath : string ) {
581
+ stderr . split ( '\n' ) . filter ( l => l ) . forEach ( line => this . logger . warn ( `stderr ${ line } ` ) ) ;
582
+ }
575
583
}
0 commit comments