Skip to content

Commit

Permalink
eclipse-lsp4jGH-330: Adapted textDocument/callHierarchy to the spec.
Browse files Browse the repository at this point in the history
  • Loading branch information
Akos Kitta committed Jul 17, 2019
1 parent 2004f41 commit 50a3b9b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,9 @@
*/
public enum CallHierarchyDirection {

/**
* The callers of a symbol.
*/
Incoming(1),
CallsFrom(1),

/**
* The callees of a symbol.
*/
Outgoing(2);
CallsTo(2);

private final int value;

Expand All @@ -38,8 +32,9 @@ public int getValue() {

public static InsertTextFormat forValue(int value) {
InsertTextFormat[] allValues = InsertTextFormat.values();
if (value < 1 || value > allValues.length)
if (value < 1 || value > allValues.length) {
throw new IllegalArgumentException("Illegal enum value: " + value);
}
return allValues[value - 1];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4833,7 +4833,7 @@ class SemanticHighlightingInformation {
class CallHierarchyParams extends TextDocumentPositionParams {

/**
* The direction of calls to resolve.
* The direction of calls to provide.
*/
@NonNull
CallHierarchyDirection direction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.util.List;
import java.util.concurrent.CompletableFuture;

import org.eclipse.lsp4j.CallHierarchyCall;
import org.eclipse.lsp4j.CallHierarchyParams;
import org.eclipse.lsp4j.CallHierarchySymbol;
import org.eclipse.lsp4j.CodeAction;
Expand Down Expand Up @@ -468,12 +469,17 @@ default CompletableFuture<TypeHierarchyItem> resolveTypeHierarchy(ResolveTypeHie
}

/**
* The {@code textDocument/callHierarchy} request is sent from the client to the server to request
* the call hierarchy for a symbol defined (or referenced) at the given text document position.
* The {@code textDocument/callHierarchy} request is sent from the client to the
* server to request the call hierarchy for a symbol defined (or referenced) at
* the given text document position. Returns a collection of calls from one
* symbol to another. The server will send a collection of
* {@link CallHierarchyCall} objects, or {@code null} if no callable symbol is
* found at the given document position. Each {@code CallHierarchyCall} object
* defines a call from one {@link CallHierarchySymbol} to another.
*/
@Beta
@JsonRequest
default CompletableFuture<CallHierarchySymbol> callHierarchy(CallHierarchyParams params) {
default CompletableFuture<List<CallHierarchyCall>> callHierarchy(CallHierarchyParams params) {
throw new UnsupportedOperationException();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
@SuppressWarnings("all")
public class CallHierarchyParams extends TextDocumentPositionParams {
/**
* The direction of calls to resolve.
* The direction of calls to provide.
*/
@NonNull
private CallHierarchyDirection direction;

/**
* The direction of calls to resolve.
* The direction of calls to provide.
*/
@Pure
@NonNull
Expand All @@ -40,7 +40,7 @@ public CallHierarchyDirection getDirection() {
}

/**
* The direction of calls to resolve.
* The direction of calls to provide.
*/
public void setDirection(@NonNull final CallHierarchyDirection direction) {
if (direction == null) {
Expand Down

0 comments on commit 50a3b9b

Please sign in to comment.