Skip to content

Commit

Permalink
Add support for exiting immediately from a shutdown() request.
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 shouldLanguageServerExitOnShutdown as true, the
  language server will exit immediately after the shutdown request
- Adjust CHANGELOG for a 0.17.1 release

Signed-off-by: Roland Grunberg <rgrunber@redhat.com>
  • Loading branch information
rgrunber authored and datho7561 committed Jun 25, 2021
1 parent 36bab63 commit d13564a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,11 @@
# Change Log

## [0.17.1](https://github.com/eclipse/lemminx/milestone/25?closed=1) (June 25, 2021)

### Bug Fixes

* Add support for exiting immediately from a shutdown() request. See [#1070](https://github.com/eclipse/lemminx/pull/1070).

## [0.17.0](https://github.com/eclipse/lemminx/milestone/23?closed=1) (June 22, 2021)

### Enhancements
Expand Down
Expand Up @@ -226,6 +226,9 @@ private synchronized void updateSettings(Object initOptions, boolean initLogs) {
@Override
public CompletableFuture<Object> shutdown() {
xmlLanguageService.dispose();
if (capabilityManager.getClientCapabilities().getExtendedCapabilities().shouldLanguageServerExitOnShutdown()) {
delayer.schedule(() -> exit(0) , 1, TimeUnit.SECONDS);
}
return computeAsync(cc -> new Object());
}

Expand Down
Expand Up @@ -26,6 +26,8 @@ public class ExtendedClientCapabilities {

private boolean openSettingsCommandSupport;

private boolean shouldLanguageServerExitOnShutdown;

public ExtendedCodeLensCapabilities getCodeLens() {
return codeLens;
}
Expand Down Expand Up @@ -75,4 +77,24 @@ public void setOpenSettingsCommandSupport(boolean openSettingsCommandSupport) {
this.openSettingsCommandSupport = openSettingsCommandSupport;
}

/**
* Sets the boolean permitting language server to exit on client
* shutdown() request, without waiting for client to call exit()
*
* @param shouldLanguageServerExitOnShutdown
*/
public void setShouldLanguageServerExitOnShutdown(boolean shouldLanguageServerExitOnShutdown) {
this.shouldLanguageServerExitOnShutdown = shouldLanguageServerExitOnShutdown;
}

/**
* Returns true if the client should exit on shutdown() request and
* avoid waiting for an exit() request
*
* @return true if the language server should exit on shutdown() request
*/
public boolean shouldLanguageServerExitOnShutdown() {
return shouldLanguageServerExitOnShutdown;
}

}

0 comments on commit d13564a

Please sign in to comment.