You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My original task is that if the LS client (Extension Host) terminates gracefully or non gracefully, I don't want my Language Server to terminate. I want the LS to decide for itself when to terminate.
It looks like the detached flag should have been the solution but I am not able to get it to working.
I've also tried:
// based on this comment: https://github.com/microsoft/vscode-languageserver-node/issues/857#issuecomment-980003467{initializationOptions: {processId: ''},}
import{createConnection,NotificationType,ProposedFeatures}from'vscode-languageserver/node';constHeartbeat: NotificationType<undefined>=newNotificationType<undefined>('heartbeat');constconnection=createConnection(ProposedFeatures.all);connection.onInitialize(()=>{connection.console.log(`PPID ${process.ppid}`);// I would expect this PID to stay alive after the PPID above is terminated, but it does notconnection.console.log(`PID ${process.pid}`);return{capabilities: {}};});connection.onNotification(Heartbeat,()=>{connection.console.log('heartbeat');});connection.listen();
Replace client/src/extension.ts
import*aspathfrom'path';import{ExtensionContext}from'vscode';import{Executable,LanguageClient,NotificationType,TransportKind}from'vscode-languageclient/node';letclient: LanguageClient;constHeartbeat: NotificationType<undefined>=newNotificationType<undefined>('heartbeat');exportasyncfunctionactivate(context: ExtensionContext){constserverModule=context.asAbsolutePath(path.join('server','out','server.js'));// `detached` is not available in ForkOptions, so I must do it this wayconstserverOptions: Executable={command: 'node',args: [serverModule],transport: TransportKind.stdio,options: {detached: true}};// Create the language client and start the client.client=newLanguageClient('languageServerExample','Language Server Example',serverOptions,// Tried this based on this comment: https://github.com/microsoft/vscode-languageserver-node/issues/857#issuecomment-980003467{initializationOptions: {processId: ''},});awaitclient.start();// Send a heartbeat every interval to show we are connected to LSPsetInterval(async()=>{awaitclient.sendNotification(Heartbeat);},5000);}exportfunctiondeactivate(): Thenable<void>|undefined{returnundefined;}
Run the extension in Debug Mode
Note the PPID+PID in the logs of the Language Server Example Output logs
Kill the PPID (Ext host)
The PID unexpectedly terminates shortly after.
Expected
I would expect that with detached: true killing the Ext Host would not impact the Language Server.
Is there any configuration that I am missing? Maybe something that needs to be configured on the LS side?
The text was updated successfully, but these errors were encountered:
My original task is that if the LS client (Extension Host) terminates gracefully or non gracefully, I don't want my Language Server to terminate. I want the LS to decide for itself when to terminate.
detached
flag should have been the solution but I am not able to get it to working.Minimal Repro
These are the following steps to setup for repro.
server/src/server.ts
with the followingclient/src/extension.ts
Language Server Example
Output logsExpected
I would expect that with
detached: true
killing the Ext Host would not impact the Language Server.Is there any configuration that I am missing? Maybe something that needs to be configured on the LS side?
The text was updated successfully, but these errors were encountered: