Question - LanguageServer shutdown and exit
gquerret opened this issue · comments
When using VSCode remote workspaces (with SSH), my language server (which is using LSP4J) stays alive forever on the server. I currently implement the shutdown
entrypoint:
@Override
public CompletableFuture<Object> shutdown() {
// Stop subprocesses started by the LS and various monitors
return CompletableFuture.completedFuture(Boolean.TRUE); // Javadoc does not specify which kind of Object to return
}
And also the exit
entrypoing:
@Override
public void exit() {
LOGGER.info("Bye !");
System.exit(0);
}
In VSCode, when using File -> Close Folder or File -> Close Remote Connection, the shutdown entrypoint is called, but not exit. Is that expected ? Or is there another way to stop the LS ?
Looks like it is a question for vscode team
I have to admit that the exit()
entrypoint is also not called when VSCode manages a local directory. Closing the VSCode window kills the Java process, but exit() is not called. Any hint on how to manage a clean shutdown of the LS (from VSCode or any other editor) ?
I think I have my answer here. As the shutdown
entrypoint can cancel the shutdown request, it has to return an object to confirm the shutdown, and then handle the shutdown by itself.