added cancel handling to highlight requests

This commit is contained in:
Martin Lippert
2021-02-26 12:32:38 +01:00
parent 1a138d4009
commit 7875ccc69f
5 changed files with 16 additions and 10 deletions

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2018, 2020 Pivotal, Inc.
* Copyright (c) 2018, 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.DocumentHighlight;
import org.eclipse.lsp4j.DocumentHighlightParams;
import org.eclipse.lsp4j.jsonrpc.CancelChecker;
@FunctionalInterface
public interface DocumentHighlightHandler {
List<? extends DocumentHighlight> handle(DocumentHighlightParams highligtParams);
List<? extends DocumentHighlight> handle(CancelChecker cancelToken, DocumentHighlightParams highligtParams);
}

View File

@@ -473,7 +473,7 @@ public class SimpleTextDocumentService implements TextDocumentService, DocumentE
DocumentHighlightHandler handler = this.documentHighlightHandler;
if (handler != null) {
return CompletableFutures.computeAsync(cancelToken -> {
return handler.handle(highlightParams);
return handler.handle(cancelToken, highlightParams);
});
}