added cancel handling to code lens requests

This commit is contained in:
Martin Lippert
2021-02-26 12:28:21 +01:00
parent 0a4e1d2898
commit 1a138d4009
5 changed files with 25 additions and 13 deletions

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2017, 2018 Pivotal, Inc.
* Copyright (c) 2017, 2021 Pivotal, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,10 +14,11 @@ import java.util.List;
import org.eclipse.lsp4j.CodeLens;
import org.eclipse.lsp4j.CodeLensParams;
import org.eclipse.lsp4j.jsonrpc.CancelChecker;
@FunctionalInterface
public interface CodeLensHandler {
List<? extends CodeLens> handle(CodeLensParams params);
List<? extends CodeLens> handle(CancelChecker cancelToken, CodeLensParams params);
}

View File

@@ -422,7 +422,7 @@ public class SimpleTextDocumentService implements TextDocumentService, DocumentE
if (handler != null) {
return CompletableFutures.computeAsync(cancelToken -> {
return handler.handle(params);
return handler.handle(cancelToken, params);
});
}
return CompletableFuture.completedFuture(Collections.emptyList());