Trying to improve the 'cleanup' of classpath listeners
This commit is contained in:
@@ -84,11 +84,19 @@ public class ClasspathListenerManager {
|
||||
|
||||
// Cleanups:
|
||||
return () -> {
|
||||
unregisterCommand.dispose();
|
||||
thenLog(log, this.server.getClient().removeClasspathListener(new ClasspathListenerParams(callbackCommandId)));
|
||||
thenLog(log, this.server.getClient().unregisterCapability(new UnregistrationParams(ImmutableList.of(
|
||||
new Unregistration(registrationId, WORKSPACE_EXECUTE_COMMAND)
|
||||
))));
|
||||
try {
|
||||
log.info("Unregistering classpath callback "+callbackCommandId +" ...");
|
||||
this.server.getClient().removeClasspathListener(
|
||||
new ClasspathListenerParams(callbackCommandId)
|
||||
).join();
|
||||
log.info("Unregistering classpath callback "+callbackCommandId +" OK");
|
||||
this.server.getClient().unregisterCapability(new UnregistrationParams(ImmutableList.of(
|
||||
new Unregistration(registrationId, WORKSPACE_EXECUTE_COMMAND)
|
||||
))).join();
|
||||
unregisterCommand.dispose();
|
||||
} catch (Exception e) {
|
||||
log.error("", e);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -432,12 +432,14 @@ public class SimpleLanguageServer implements Sts4LanguageServer, LanguageClientA
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Object> shutdown() {
|
||||
return async.invoke(() -> {
|
||||
Runnable h = shutdownHandler;
|
||||
if (h!=null) {
|
||||
h.run();
|
||||
}
|
||||
getWorkspaceService().dispose();
|
||||
return CompletableFuture.completedFuture(new Object());
|
||||
return "OK";
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -76,7 +76,7 @@ public class JdtLsProjectCache implements JavaProjectFinder, ProjectObserver {
|
||||
}))
|
||||
);
|
||||
this.server.onShutdown(() ->
|
||||
disposable.thenAccept(Disposable::dispose)
|
||||
disposable.thenAccept(Disposable::dispose).join()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,10 +6,16 @@ import { LanguageClient, RequestType } from 'vscode-languageclient';
|
||||
|
||||
export function registerClasspathService(client : LanguageClient) : void {
|
||||
|
||||
let classpathListenerRequest = new RequestType<ClasspathListenerParams, ClasspathListenerResponse, void, void>("sts/addClasspathListener");
|
||||
client.onRequest(classpathListenerRequest, async (params: ClasspathListenerParams) => {
|
||||
let addRequest = new RequestType<ClasspathListenerParams, ClasspathListenerResponse, void, void>("sts/addClasspathListener");
|
||||
client.onRequest(addRequest, async (params: ClasspathListenerParams) => {
|
||||
return <ClasspathListenerResponse> await VSCode.commands.executeCommand("java.execute.workspaceCommand", "sts.java.addClasspathListener", params.callbackCommandId);
|
||||
});
|
||||
|
||||
let removeRequest = new RequestType<ClasspathListenerParams, ClasspathListenerResponse, void, void>("sts/removeClasspathListener");
|
||||
client.onRequest(removeRequest, async (params: ClasspathListenerParams) => {
|
||||
return <ClasspathListenerResponse> await VSCode.commands.executeCommand("java.execute.workspaceCommand", "sts.java.removeClasspathListener", params.callbackCommandId);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
interface ClasspathListenerParams {
|
||||
|
||||
@@ -20,7 +20,7 @@ const JAVA_LANGUAGE_ID = "java";
|
||||
export function activate(context: VSCode.ExtensionContext) {
|
||||
let options : commons.ActivatorOptions = {
|
||||
DEBUG: false,
|
||||
CONNECT_TO_LS: false,
|
||||
CONNECT_TO_LS: true,
|
||||
extensionId: 'vscode-spring-boot',
|
||||
preferJdk: true,
|
||||
checkjvm: (context: VSCode.ExtensionContext, jvm: commons.JVM) => {
|
||||
|
||||
Reference in New Issue
Block a user