Skip to content

Commit

Permalink
Introduce syntaxServerExitsOnShutdown as an extended capability.
Browse files Browse the repository at this point in the history
- In languageclient 7.x, the client fails to send the necessary exit()
  once a shutdown() response is received from the language server
- When client defines syntaxServerExitsOnShutdown as true, the language
  server will exit immediately after the shutdown request

Signed-off-by: Roland Grunberg <rgrunber@redhat.com>
  • Loading branch information
rgrunber committed Jun 3, 2021
1 parent 9c41c18 commit ef61f5f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,10 @@ public boolean isActionableRuntimeNotificationSupport() {
return Boolean.parseBoolean(extendedClientCapabilities.getOrDefault("actionableRuntimeNotificationSupport", "false").toString());
}

public boolean isSyntaxServerExitsOnShutdown() {
return Boolean.parseBoolean(extendedClientCapabilities.getOrDefault("syntaxServerExitsOnShutdown", "false").toString());
}

public boolean isGradleChecksumWrapperPromptSupport() {
return Boolean.parseBoolean(extendedClientCapabilities.getOrDefault("gradleChecksumWrapperPromptSupport", "false").toString());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,17 @@ public CompletableFuture<Object> shutdown() {
return computeAsync((monitor) -> {
shutdownJob.schedule();
shutdownReceived = true;
if (preferenceManager.getClientPreferences().isSyntaxServerExitsOnShutdown()) {
exit();
try {
/*
* Suppress annoying error message in client, by encouraging
* syntax server to exit before shutdown() can respond to client.
*/
Thread.sleep(1000);
} catch (InterruptedException e) {
}
}
return new Object();
});
}
Expand Down

0 comments on commit ef61f5f

Please sign in to comment.