added cancel handling to references requests
This commit is contained in:
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user