@@ -61,6 +61,8 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
6161 return ;
6262 }
6363
64+ let client : LanguageClient ;
65+
6466 const serverOptions = ( ) => new Promise < ChildProcess | StreamInfo > ( ( resolve , reject ) => {
6567 // Use a TCP socket because of problems with blocking STDIO
6668 const server = net . createServer ( socket => {
@@ -81,10 +83,18 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
8183 '--memory-limit=' + memoryLimit
8284 ] ) ;
8385 childProcess . stderr . on ( 'data' , ( chunk : Buffer ) => {
84- console . error ( chunk + '' ) ;
86+ const str = chunk . toString ( ) ;
87+ console . log ( 'PHP Language Server:' , str ) ;
88+ client . outputChannel . appendLine ( str ) ;
8589 } ) ;
86- childProcess . stdout . on ( 'data' , ( chunk : Buffer ) => {
87- console . log ( chunk + '' ) ;
90+ // childProcess.stdout.on('data', (chunk: Buffer) => {
91+ // console.log('PHP Language Server:', chunk + '');
92+ // });
93+ childProcess . on ( 'exit' , ( code , signal ) => {
94+ client . outputChannel . appendLine ( `Language server exited ` + ( signal ? `from signal ${ signal } ` : `with exit code ${ code } ` ) ) ;
95+ if ( code !== 0 ) {
96+ client . outputChannel . show ( ) ;
97+ }
8898 } ) ;
8999 return childProcess ;
90100 } ) ;
@@ -112,7 +122,8 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
112122 } ;
113123
114124 // Create the language client and start the client.
115- const disposable = new LanguageClient ( 'PHP Language Server' , serverOptions , clientOptions ) . start ( ) ;
125+ client = new LanguageClient ( 'PHP Language Server' , serverOptions , clientOptions ) ;
126+ const disposable = client . start ( ) ;
116127
117128 // Push the disposable to the context's subscriptions so that the
118129 // client can be deactivated on extension deactivation
0 commit comments