added cancel handling to references requests

This commit is contained in:
Martin Lippert
2021-02-26 12:23:27 +01:00
parent 607781779e
commit 0a4e1d2898
5 changed files with 30 additions and 15 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.Location;
import org.eclipse.lsp4j.ReferenceParams;
import org.eclipse.lsp4j.jsonrpc.CancelChecker;
@FunctionalInterface
public interface ReferencesHandler {
List<? extends Location> handle(ReferenceParams params);
List<? extends Location> handle(CancelChecker cancelToken, ReferenceParams params);
}

View File

@@ -350,7 +350,7 @@ public class SimpleTextDocumentService implements TextDocumentService, DocumentE
if (h != null) {
return CompletableFutures.computeAsync(cancelToken -> {
List<? extends Location> list = h.handle(params);
List<? extends Location> list = h.handle(cancelToken, params);
return list != null && list.isEmpty() ? null : list;
});
}