Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update call hierarchy for lsp4j #387

Merged
merged 2 commits into from
Dec 18, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 53 additions & 24 deletions org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/Protocol.xtend
Original file line number Diff line number Diff line change
Expand Up @@ -4850,73 +4850,102 @@ class SemanticHighlightingInformation {
}

/**
* Returns a collection of calls from one symbol to another.
* The parameter of a `textDocument/prepareCallHierarchy` request.
*/
@Beta
@JsonRpcData
class CallHierarchyParams extends TextDocumentPositionParams {
class CallHierarchyPrepareParams extends TextDocumentPositionParams {

/**
* The direction of calls to provide.
*/
@NonNull
CallHierarchyDirection direction
}

/**
* The parameter of a `callHierarchy/incomingCalls` request.
*/
@Beta
@JsonRpcData
class CallHierarchyIncomingCallsParams {
CallHierarchyItem item
}

/**
* Each {@code CallHierarchyCall} object defines a call from one {@code CallHierarchySymbol} to another.
* The parameter of a `callHierarchy/outgoingCalls` request.
*/
@Beta
@JsonRpcData
class CallHierarchyCall {
class CallHierarchyOutgoingCallsParams {
CallHierarchyItem item
}

/**
* Represents an incoming call, e.g. a caller of a method or constructor.
*/
@Beta
@JsonRpcData
class CallHierarchyIncomingCall {

/**
* The source range of the reference. The range is a sub range of the {@link CallHierarchyCall#getFrom from} symbol range.
* The item that makes the call.
*/
@NonNull
Range range
CallHierarchyItem from

/**
* The symbol that contains the reference.
* The range at which at which the calls appears. This is relative to the caller
* denoted by [`this.from`](#CallHierarchyIncomingCall.from).
*/
@NonNull
CallHierarchySymbol from
Range[] fromRanges
testforstephen marked this conversation as resolved.
Show resolved Hide resolved
}

/**
* Represents an outgoing call, e.g. calling a getter from a method or a method from a constructor etc.
*/
@Beta
@JsonRpcData
class CallHierarchyOutgoingCall {

/**
* The symbol that is referenced.
* The item that is called.
*/
@NonNull
CallHierarchySymbol to
CallHierarchyItem to

/**
* The range at which this item is called. This is the range relative to the caller, e.g the item
* passed to [`provideCallHierarchyOutgoingCalls`](#CallHierarchyItemProvider.provideCallHierarchyOutgoingCalls)
* and not [`this.to`](#CallHierarchyOutgoingCall.to).
*/
Range[] fromRanges
testforstephen marked this conversation as resolved.
Show resolved Hide resolved
}

/**
* The result of a {@code textDocument/callHierarchy} request.
*/
@Beta
@JsonRpcData
class CallHierarchySymbol {
class CallHierarchyItem {

/**
* The name of the symbol targeted by the call hierarchy request.
* The name of the item targeted by the call hierarchy request.
*/
@NonNull
String name

/**
* More detail for this symbol, e.g the signature of a function.
* More detail for this item, e.g the signature of a function.
*/
String detail

/**
* The kind of this symbol.
* The kind of this item.
*/
@NonNull
SymbolKind kind

/**
* URI of the document containing the symbol.
* Tags for this item.
*/
SymbolTag[] tags
testforstephen marked this conversation as resolved.
Show resolved Hide resolved
spoenemann marked this conversation as resolved.
Show resolved Hide resolved

/**
* The resource identifier of this item.
*/
@NonNull
String uri
Expand All @@ -4931,7 +4960,7 @@ class CallHierarchySymbol {

/**
* The range that should be selected and revealed when this symbol is being picked, e.g the name of a function.
* Must be contained by the the {@link CallHierarchySymbol#getRange range}.
* Must be contained by the the {@link CallHierarchyItem#getRange range}.
*/
@NonNull
Range selectionRange
Expand Down
32 changes: 32 additions & 0 deletions org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/SymbolTag.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/******************************************************************************
* Copyright (c) 2019 Microsoft Corporation and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0,
* or the Eclipse Distribution License v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
******************************************************************************/

package org.eclipse.lsp4j;

/**
* Symbol tags are extra annotations that tweak the rendering of a symbol.
* @since 3.15
*/
public enum SymbolTag {

Deprecated(1);

private final int value;

SymbolTag(int value) {
this.value = value;
}

public int getValue() {
return value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@
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.CallHierarchyIncomingCall;
import org.eclipse.lsp4j.CallHierarchyIncomingCallsParams;
import org.eclipse.lsp4j.CallHierarchyOutgoingCall;
import org.eclipse.lsp4j.CallHierarchyOutgoingCallsParams;
import org.eclipse.lsp4j.CallHierarchyPrepareParams;
import org.eclipse.lsp4j.CallHierarchyItem;
import org.eclipse.lsp4j.CodeAction;
import org.eclipse.lsp4j.CodeActionParams;
import org.eclipse.lsp4j.CodeLens;
Expand Down Expand Up @@ -469,21 +472,38 @@ 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. 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.
* Bootstraps call hierarchy by returning the item that is denoted by the given document
* and position. This item will be used as entry into the call graph. Providers should
* return null when there is no item at the given location.
*/
@Beta
@JsonRequest
default CompletableFuture<List<CallHierarchyCall>> callHierarchy(CallHierarchyParams params) {
default CompletableFuture<List<CallHierarchyItem>> prepareCallHierarchy(CallHierarchyPrepareParams params) {
throw new UnsupportedOperationException();
}

/**
* Provide all incoming calls for an item, e.g all callers for a method. In graph terms this descibes directed
* and annotated edges inside the call graph, e.g the given item is the starting node and the result is the nodes
* that can be reached.
*/
@Beta
@JsonRequest(value="callHierarchy/incomingCalls", useSegment = false)
default CompletableFuture<List<CallHierarchyIncomingCall>> callHierarchyIncomingCalls(CallHierarchyIncomingCallsParams params) {
throw new UnsupportedOperationException();
}

/**
* Provide all outgoing calls for an item, e.g call calls to functions, methods, or constructors from the given item. In
* graph terms this descibes directed and annotated edges inside the call graph, e.g the given item is the starting
* node and the result is the nodes that can be reached.
*/
@Beta
@JsonRequest(value="callHierarchy/outgoingCalls", useSegment = false)
default CompletableFuture<List<CallHierarchyOutgoingCall>> callHierarchyOutgoingCalls(CallHierarchyOutgoingCallsParams params) {
throw new UnsupportedOperationException();
}


/**
* The {@code textDocument/selectionRange} request is sent from the client to the server to return
* suggested selection ranges at an array of given positions. A selection range is a range around
Expand Down

This file was deleted.

Loading