diff --git a/org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/Protocol.xtend b/org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/Protocol.xtend index 1927189a1..34e557ac0 100644 --- a/org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/Protocol.xtend +++ b/org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/Protocol.xtend @@ -751,10 +751,16 @@ class FoldingRangeCapabilities extends DynamicRegistrationCapabilities { /** * Capabilities specific to {@code textDocument/semanticHighlighting}. + * + *

+ * Note: the {@code textDocument/semanticHighlighting} + * language feature is not yet part of the official LSP specification. */ @Beta @JsonRpcData class SemanticHighlightingCapabilities { + /** * The client supports semantic highlighting. */ @@ -771,6 +777,11 @@ class SemanticHighlightingCapabilities { /** * Capabilities specific to the {@code textDocument/typeHierarchy} and the {@code typeHierarchy/resolve} * language server methods. + * + *

+ * Note: the {@code textDocument/typeHierarchy} + * language feature is not yet part of the official LSP specification. */ @Beta @JsonRpcData @@ -781,11 +792,29 @@ class TypeHierarchyCapabilities { */ Boolean typeHierarchy + new(Boolean typeHierarchy) { + this.typeHierarchy = typeHierarchy + } + +} + +/** + * Capabilities specific to the {@code textDocument/callHierarchy}. + * + *

+ * Note: the {@code textDocument/callHierarchy} + * language feature is not yet part of the official LSP specification. + */ +@Beta +@JsonRpcData +class CallHierarchyCapabilities extends DynamicRegistrationCapabilities { + new() { } - new(Boolean typeHierarchy) { - this.typeHierarchy = typeHierarchy + new(Boolean dynamicRegistration) { + super(dynamicRegistration) } } @@ -912,6 +941,13 @@ class TextDocumentClientCapabilities { */ @Beta TypeHierarchyCapabilities typeHierarchyCapabilities + + /** + * Capabilities specific to {@code textDocument/callHierarchy}. + */ + @Beta + CallHierarchyCapabilities callHierarchy + } /** @@ -2837,14 +2873,32 @@ class ServerCapabilities { /** * Semantic highlighting server capabilities. */ + @Beta SemanticHighlightingServerCapabilities semanticHighlighting /** * Server capability for calculating super- and subtype hierarchies. * The LS supports the type hierarchy language feature, if this capability is set to {@code true}. + * + *

+ * Note: the {@code textDocument/typeHierarchy} + * language feature is not yet part of the official LSP specification. */ + @Beta Boolean typeHierarchy + /** + * The server provides Call Hierarchy support. + * + *

+ * Note: the {@code textDocument/callHierarchy} + * language feature is not yet part of the official LSP specification. + */ + @Beta + Either callHierarchyProvider + /** * Experimental server capabilities. */ @@ -2875,6 +2929,11 @@ class WorkspaceServerCapabilities { /** * Semantic highlighting server capabilities. + * + *

+ * Note: the {@code textDocument/semanticHighlighting} + * language feature is not yet part of the official LSP specification. */ @Beta @JsonRpcData @@ -4598,3 +4657,124 @@ class SemanticHighlightingInformation { this.tokens = tokens } } + +/** + * The parameters of a {@code textDocument/callHierarchy} request. + */ +@Beta +@JsonRpcData +class CallHierarchyParams extends TextDocumentPositionParams { + + /** + * The number of levels to resolve. + */ + int resolve + + /** + * Outgoing direction for callees. Valid values are: {@code incoming} and {@code outgoing}. + * The default is {@code incoming} for callers. + */ + String direction + +} + +/** + * The parameters of a {@code callHierarchy/resolve} request. + */ +@Beta +@JsonRpcData +class ResolveCallHierarchyItemParams { + + /** + * Unresolved item. + */ + @NonNull + CallHierarchyItem item + + /** + * The number of levels to resolve. + */ + int resolve + + /** + * Outgoing direction for callees. Valid values are: {@code incoming} and {@code outgoing}. + * The default is {@code incoming} for callers. + */ + @NonNull + String direction + +} + +/** + * The result of a {@code textDocument/callHierarchy} request. + */ +@Beta +@JsonRpcData +class CallHierarchyItem { + + /** + * The name of the symbol targeted by the call hierarchy request. + */ + @NonNull + String name + + /** + * More detail for this symbol, e.g the signature of a function. + */ + String detail + + /** + * The kind of this symbol. + */ + @NonNull + SymbolKind kind + + /** + * URI of the document containing the symbol. + */ + @NonNull + String uri + + /** + * The range enclosing this symbol not including leading/trailing whitespace but everything else + * like comments. This information is typically used to determine if the the clients cursor is + * inside the symbol to reveal in the symbol in the UI. + */ + @NonNull + Range range + + /** + * 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 {@code range}. + */ + @NonNull + Range selectionRange + + /** + * The actual location of the call. + * + * Must be defined in resolved callers/callees. + */ + Location callLocation + + /** + * List of incoming calls. + * + * Note: The items is unresolved if {@code callers} and {@code callees} is not defined. + */ + List callers + + /** + * List of outgoing calls. + * + * *Note*: The items is unresolved if {@code callers} and {@code callees} is not defined. + */ + List callees + + /** + * Optional data to identify an item in a resolve request. + */ + @JsonAdapter(JsonElementTypeAdapter.Factory) + Object data + +} \ No newline at end of file diff --git a/org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/services/LanguageClient.java b/org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/services/LanguageClient.java index a2f83c947..f5a1960d7 100644 --- a/org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/services/LanguageClient.java +++ b/org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/services/LanguageClient.java @@ -130,6 +130,11 @@ default CompletableFuture> configuration(ConfigurationParams config * the server sends the semantic highlighting information for the entire document, but if the server * receives a {@code DidChangeTextDocumentNotification}, it pushes the information only about * the affected lines in the document. + * + *

+ * Note: the {@code textDocument/semanticHighlighting} + * language feature is not yet part of the official LSP specification. */ @Beta @JsonNotification("textDocument/semanticHighlighting") diff --git a/org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/services/TextDocumentService.java b/org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/services/TextDocumentService.java index 285830721..591d6d2b7 100644 --- a/org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/services/TextDocumentService.java +++ b/org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/services/TextDocumentService.java @@ -14,6 +14,8 @@ import java.util.List; import java.util.concurrent.CompletableFuture; +import org.eclipse.lsp4j.CallHierarchyItem; +import org.eclipse.lsp4j.CallHierarchyParams; import org.eclipse.lsp4j.CodeAction; import org.eclipse.lsp4j.CodeActionParams; import org.eclipse.lsp4j.CodeLens; @@ -47,6 +49,7 @@ import org.eclipse.lsp4j.Range; import org.eclipse.lsp4j.ReferenceParams; import org.eclipse.lsp4j.RenameParams; +import org.eclipse.lsp4j.ResolveCallHierarchyItemParams; import org.eclipse.lsp4j.ResolveTypeHierarchyItemParams; import org.eclipse.lsp4j.SignatureHelp; import org.eclipse.lsp4j.SymbolInformation; @@ -415,6 +418,11 @@ default CompletableFuture> prepareRename(Text * request would also allow to specify if the item should be resolved and * whether sub- or supertypes are to be resolved. If no type hierarchy item can * be found under the given text document position, resolves to {@code null}. + * + *

+ * Note: the {@code textDocument/typeHierarchy} + * language feature is not yet part of the official LSP specification. */ @Beta @JsonRequest @@ -428,6 +436,11 @@ default CompletableFuture typeHierarchy(TypeHierarchyParams p * item}. A type hierarchy item is unresolved if the if the * {@link TypeHierarchyItem#getParents parents} or the * {@link TypeHierarchyItem#getChildren children} is not defined. + * + *

+ * Note: the {@code textDocument/typeHierarchy} + * language feature is not yet part of the official LSP specification. */ @Beta @JsonRequest(value="typeHierarchy/resolve", useSegment = false) @@ -435,4 +448,39 @@ default CompletableFuture resolveTypeHierarchy(ResolveTypeHie throw new UnsupportedOperationException(); } + /** + * Request to request the call hierarchy at a given text document position. + * + * The optional request's parameter defines the maximum number of levels to + * {@link CallHierarchyParams#getResolve() resolve} by this request. Unresolved + * items can be resolved in subsequent {@code callHierarchy/resolve} requests. + * + *

+ * Note: the {@code textDocument/callHierarchy} + * language feature is not yet part of the official LSP specification. + */ + @Beta + @JsonRequest + default CompletableFuture callHierarchy(CallHierarchyParams params) { + throw new UnsupportedOperationException(); + } + + /** + * Request to resolve a call hierarchy item. + * + * The request's parameter is of type {@link ResolveCallHierarchyItemParams}. + * The response is of type {@link CallHierarchyItem}. + * + *

+ * Note: the {@code textDocument/callHierarchy} + * language feature is not yet part of the official LSP specification. + */ + @Beta + @JsonRequest(value = "callHierarchy/resolve", useSegment = false) + default CompletableFuture resolveCallHierarchy(ResolveCallHierarchyItemParams params) { + throw new UnsupportedOperationException(); + } + } diff --git a/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/CallHierarchyCapabilities.java b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/CallHierarchyCapabilities.java new file mode 100644 index 000000000..226366075 --- /dev/null +++ b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/CallHierarchyCapabilities.java @@ -0,0 +1,64 @@ +/** + * Copyright (c) 2016-2018 TypeFox 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; + +import com.google.common.annotations.Beta; +import org.eclipse.lsp4j.DynamicRegistrationCapabilities; +import org.eclipse.xtext.xbase.lib.Pure; +import org.eclipse.xtext.xbase.lib.util.ToStringBuilder; + +/** + * Capabilities specific to the {@code textDocument/callHierarchy}. + * + *

+ * Note: the {@code textDocument/callHierarchy} + * language feature is not yet part of the official LSP specification. + */ +@Beta +@SuppressWarnings("all") +public class CallHierarchyCapabilities extends DynamicRegistrationCapabilities { + public CallHierarchyCapabilities() { + } + + public CallHierarchyCapabilities(final Boolean dynamicRegistration) { + super(dynamicRegistration); + } + + @Override + @Pure + public String toString() { + ToStringBuilder b = new ToStringBuilder(this); + b.add("dynamicRegistration", getDynamicRegistration()); + return b.toString(); + } + + @Override + @Pure + public boolean equals(final Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + if (!super.equals(obj)) + return false; + return true; + } + + @Override + @Pure + public int hashCode() { + return super.hashCode(); + } +} diff --git a/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/CallHierarchyItem.java b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/CallHierarchyItem.java new file mode 100644 index 000000000..c4be8064d --- /dev/null +++ b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/CallHierarchyItem.java @@ -0,0 +1,365 @@ +/** + * Copyright (c) 2016-2018 TypeFox 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; + +import com.google.common.annotations.Beta; +import com.google.gson.annotations.JsonAdapter; +import java.util.List; +import org.eclipse.lsp4j.Location; +import org.eclipse.lsp4j.Range; +import org.eclipse.lsp4j.SymbolKind; +import org.eclipse.lsp4j.jsonrpc.json.adapters.JsonElementTypeAdapter; +import org.eclipse.lsp4j.jsonrpc.validation.NonNull; +import org.eclipse.xtext.xbase.lib.Pure; +import org.eclipse.xtext.xbase.lib.util.ToStringBuilder; + +/** + * The result of a {@code textDocument/callHierarchy} request. + */ +@Beta +@SuppressWarnings("all") +public class CallHierarchyItem { + /** + * The name of the symbol targeted by the call hierarchy request. + */ + @NonNull + private String name; + + /** + * More detail for this symbol, e.g the signature of a function. + */ + private String detail; + + /** + * The kind of this symbol. + */ + @NonNull + private SymbolKind kind; + + /** + * URI of the document containing the symbol. + */ + @NonNull + private String uri; + + /** + * The range enclosing this symbol not including leading/trailing whitespace but everything else + * like comments. This information is typically used to determine if the the clients cursor is + * inside the symbol to reveal in the symbol in the UI. + */ + @NonNull + private Range range; + + /** + * 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 {@code range}. + */ + @NonNull + private Range selectionRange; + + /** + * The actual location of the call. + * + * Must be defined in resolved callers/callees. + */ + private Location callLocation; + + /** + * List of incoming calls. + * + * Note: The items is unresolved if {@code callers} and {@code callees} is not defined. + */ + private List callers; + + /** + * List of outgoing calls. + * + * *Note*: The items is unresolved if {@code callers} and {@code callees} is not defined. + */ + private List callees; + + /** + * Optional data to identify an item in a resolve request. + */ + @JsonAdapter(JsonElementTypeAdapter.Factory.class) + private Object data; + + /** + * The name of the symbol targeted by the call hierarchy request. + */ + @Pure + @NonNull + public String getName() { + return this.name; + } + + /** + * The name of the symbol targeted by the call hierarchy request. + */ + public void setName(@NonNull final String name) { + this.name = name; + } + + /** + * More detail for this symbol, e.g the signature of a function. + */ + @Pure + public String getDetail() { + return this.detail; + } + + /** + * More detail for this symbol, e.g the signature of a function. + */ + public void setDetail(final String detail) { + this.detail = detail; + } + + /** + * The kind of this symbol. + */ + @Pure + @NonNull + public SymbolKind getKind() { + return this.kind; + } + + /** + * The kind of this symbol. + */ + public void setKind(@NonNull final SymbolKind kind) { + this.kind = kind; + } + + /** + * URI of the document containing the symbol. + */ + @Pure + @NonNull + public String getUri() { + return this.uri; + } + + /** + * URI of the document containing the symbol. + */ + public void setUri(@NonNull final String uri) { + this.uri = uri; + } + + /** + * The range enclosing this symbol not including leading/trailing whitespace but everything else + * like comments. This information is typically used to determine if the the clients cursor is + * inside the symbol to reveal in the symbol in the UI. + */ + @Pure + @NonNull + public Range getRange() { + return this.range; + } + + /** + * The range enclosing this symbol not including leading/trailing whitespace but everything else + * like comments. This information is typically used to determine if the the clients cursor is + * inside the symbol to reveal in the symbol in the UI. + */ + public void setRange(@NonNull final Range range) { + this.range = range; + } + + /** + * 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 {@code range}. + */ + @Pure + @NonNull + public Range getSelectionRange() { + return this.selectionRange; + } + + /** + * 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 {@code range}. + */ + public void setSelectionRange(@NonNull final Range selectionRange) { + this.selectionRange = selectionRange; + } + + /** + * The actual location of the call. + * + * Must be defined in resolved callers/callees. + */ + @Pure + public Location getCallLocation() { + return this.callLocation; + } + + /** + * The actual location of the call. + * + * Must be defined in resolved callers/callees. + */ + public void setCallLocation(final Location callLocation) { + this.callLocation = callLocation; + } + + /** + * List of incoming calls. + * + * Note: The items is unresolved if {@code callers} and {@code callees} is not defined. + */ + @Pure + public List getCallers() { + return this.callers; + } + + /** + * List of incoming calls. + * + * Note: The items is unresolved if {@code callers} and {@code callees} is not defined. + */ + public void setCallers(final List callers) { + this.callers = callers; + } + + /** + * List of outgoing calls. + * + * *Note*: The items is unresolved if {@code callers} and {@code callees} is not defined. + */ + @Pure + public List getCallees() { + return this.callees; + } + + /** + * List of outgoing calls. + * + * *Note*: The items is unresolved if {@code callers} and {@code callees} is not defined. + */ + public void setCallees(final List callees) { + this.callees = callees; + } + + /** + * Optional data to identify an item in a resolve request. + */ + @Pure + public Object getData() { + return this.data; + } + + /** + * Optional data to identify an item in a resolve request. + */ + public void setData(final Object data) { + this.data = data; + } + + @Override + @Pure + public String toString() { + ToStringBuilder b = new ToStringBuilder(this); + b.add("name", this.name); + b.add("detail", this.detail); + b.add("kind", this.kind); + b.add("uri", this.uri); + b.add("range", this.range); + b.add("selectionRange", this.selectionRange); + b.add("callLocation", this.callLocation); + b.add("callers", this.callers); + b.add("callees", this.callees); + b.add("data", this.data); + return b.toString(); + } + + @Override + @Pure + public boolean equals(final Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + CallHierarchyItem other = (CallHierarchyItem) obj; + if (this.name == null) { + if (other.name != null) + return false; + } else if (!this.name.equals(other.name)) + return false; + if (this.detail == null) { + if (other.detail != null) + return false; + } else if (!this.detail.equals(other.detail)) + return false; + if (this.kind == null) { + if (other.kind != null) + return false; + } else if (!this.kind.equals(other.kind)) + return false; + if (this.uri == null) { + if (other.uri != null) + return false; + } else if (!this.uri.equals(other.uri)) + return false; + if (this.range == null) { + if (other.range != null) + return false; + } else if (!this.range.equals(other.range)) + return false; + if (this.selectionRange == null) { + if (other.selectionRange != null) + return false; + } else if (!this.selectionRange.equals(other.selectionRange)) + return false; + if (this.callLocation == null) { + if (other.callLocation != null) + return false; + } else if (!this.callLocation.equals(other.callLocation)) + return false; + if (this.callers == null) { + if (other.callers != null) + return false; + } else if (!this.callers.equals(other.callers)) + return false; + if (this.callees == null) { + if (other.callees != null) + return false; + } else if (!this.callees.equals(other.callees)) + return false; + if (this.data == null) { + if (other.data != null) + return false; + } else if (!this.data.equals(other.data)) + return false; + return true; + } + + @Override + @Pure + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.name== null) ? 0 : this.name.hashCode()); + result = prime * result + ((this.detail== null) ? 0 : this.detail.hashCode()); + result = prime * result + ((this.kind== null) ? 0 : this.kind.hashCode()); + result = prime * result + ((this.uri== null) ? 0 : this.uri.hashCode()); + result = prime * result + ((this.range== null) ? 0 : this.range.hashCode()); + result = prime * result + ((this.selectionRange== null) ? 0 : this.selectionRange.hashCode()); + result = prime * result + ((this.callLocation== null) ? 0 : this.callLocation.hashCode()); + result = prime * result + ((this.callers== null) ? 0 : this.callers.hashCode()); + result = prime * result + ((this.callees== null) ? 0 : this.callees.hashCode()); + return prime * result + ((this.data== null) ? 0 : this.data.hashCode()); + } +} diff --git a/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/CallHierarchyParams.java b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/CallHierarchyParams.java new file mode 100644 index 000000000..a15349490 --- /dev/null +++ b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/CallHierarchyParams.java @@ -0,0 +1,110 @@ +/** + * Copyright (c) 2016-2018 TypeFox 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; + +import com.google.common.annotations.Beta; +import org.eclipse.lsp4j.TextDocumentPositionParams; +import org.eclipse.xtext.xbase.lib.Pure; +import org.eclipse.xtext.xbase.lib.util.ToStringBuilder; + +/** + * The parameters of a {@code textDocument/callHierarchy} request. + */ +@Beta +@SuppressWarnings("all") +public class CallHierarchyParams extends TextDocumentPositionParams { + /** + * The number of levels to resolve. + */ + private int resolve; + + /** + * Outgoing direction for callees. Valid values are: {@code incoming} and {@code outgoing}. + * The default is {@code incoming} for callers. + */ + private String direction; + + /** + * The number of levels to resolve. + */ + @Pure + public int getResolve() { + return this.resolve; + } + + /** + * The number of levels to resolve. + */ + public void setResolve(final int resolve) { + this.resolve = resolve; + } + + /** + * Outgoing direction for callees. Valid values are: {@code incoming} and {@code outgoing}. + * The default is {@code incoming} for callers. + */ + @Pure + public String getDirection() { + return this.direction; + } + + /** + * Outgoing direction for callees. Valid values are: {@code incoming} and {@code outgoing}. + * The default is {@code incoming} for callers. + */ + public void setDirection(final String direction) { + this.direction = direction; + } + + @Override + @Pure + public String toString() { + ToStringBuilder b = new ToStringBuilder(this); + b.add("resolve", this.resolve); + b.add("direction", this.direction); + b.add("textDocument", getTextDocument()); + b.add("uri", getUri()); + b.add("position", getPosition()); + return b.toString(); + } + + @Override + @Pure + public boolean equals(final Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + if (!super.equals(obj)) + return false; + CallHierarchyParams other = (CallHierarchyParams) obj; + if (other.resolve != this.resolve) + return false; + if (this.direction == null) { + if (other.direction != null) + return false; + } else if (!this.direction.equals(other.direction)) + return false; + return true; + } + + @Override + @Pure + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + this.resolve; + return prime * result + ((this.direction== null) ? 0 : this.direction.hashCode()); + } +} diff --git a/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/ResolveCallHierarchyItemParams.java b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/ResolveCallHierarchyItemParams.java new file mode 100644 index 000000000..d4eba0abd --- /dev/null +++ b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/ResolveCallHierarchyItemParams.java @@ -0,0 +1,137 @@ +/** + * Copyright (c) 2016-2018 TypeFox 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; + +import com.google.common.annotations.Beta; +import org.eclipse.lsp4j.CallHierarchyItem; +import org.eclipse.lsp4j.jsonrpc.validation.NonNull; +import org.eclipse.xtext.xbase.lib.Pure; +import org.eclipse.xtext.xbase.lib.util.ToStringBuilder; + +/** + * The parameters of a {@code callHierarchy/resolve} request. + */ +@Beta +@SuppressWarnings("all") +public class ResolveCallHierarchyItemParams { + /** + * Unresolved item. + */ + @NonNull + private CallHierarchyItem item; + + /** + * The number of levels to resolve. + */ + private int resolve; + + /** + * Outgoing direction for callees. Valid values are: {@code incoming} and {@code outgoing}. + * The default is {@code incoming} for callers. + */ + @NonNull + private String direction; + + /** + * Unresolved item. + */ + @Pure + @NonNull + public CallHierarchyItem getItem() { + return this.item; + } + + /** + * Unresolved item. + */ + public void setItem(@NonNull final CallHierarchyItem item) { + this.item = item; + } + + /** + * The number of levels to resolve. + */ + @Pure + public int getResolve() { + return this.resolve; + } + + /** + * The number of levels to resolve. + */ + public void setResolve(final int resolve) { + this.resolve = resolve; + } + + /** + * Outgoing direction for callees. Valid values are: {@code incoming} and {@code outgoing}. + * The default is {@code incoming} for callers. + */ + @Pure + @NonNull + public String getDirection() { + return this.direction; + } + + /** + * Outgoing direction for callees. Valid values are: {@code incoming} and {@code outgoing}. + * The default is {@code incoming} for callers. + */ + public void setDirection(@NonNull final String direction) { + this.direction = direction; + } + + @Override + @Pure + public String toString() { + ToStringBuilder b = new ToStringBuilder(this); + b.add("item", this.item); + b.add("resolve", this.resolve); + b.add("direction", this.direction); + return b.toString(); + } + + @Override + @Pure + public boolean equals(final Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ResolveCallHierarchyItemParams other = (ResolveCallHierarchyItemParams) obj; + if (this.item == null) { + if (other.item != null) + return false; + } else if (!this.item.equals(other.item)) + return false; + if (other.resolve != this.resolve) + return false; + if (this.direction == null) { + if (other.direction != null) + return false; + } else if (!this.direction.equals(other.direction)) + return false; + return true; + } + + @Override + @Pure + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.item== null) ? 0 : this.item.hashCode()); + result = prime * result + this.resolve; + return prime * result + ((this.direction== null) ? 0 : this.direction.hashCode()); + } +} diff --git a/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticHighlightingCapabilities.java b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticHighlightingCapabilities.java index 7f3489407..05a929b94 100644 --- a/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticHighlightingCapabilities.java +++ b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticHighlightingCapabilities.java @@ -17,6 +17,11 @@ /** * Capabilities specific to {@code textDocument/semanticHighlighting}. + * + *

+ * Note: the {@code textDocument/semanticHighlighting} + * language feature is not yet part of the official LSP specification. */ @Beta @SuppressWarnings("all") diff --git a/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticHighlightingServerCapabilities.java b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticHighlightingServerCapabilities.java index c06e5ac28..bab0d3f03 100644 --- a/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticHighlightingServerCapabilities.java +++ b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticHighlightingServerCapabilities.java @@ -18,6 +18,11 @@ /** * Semantic highlighting server capabilities. + * + *

+ * Note: the {@code textDocument/semanticHighlighting} + * language feature is not yet part of the official LSP specification. */ @Beta @SuppressWarnings("all") diff --git a/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/ServerCapabilities.java b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/ServerCapabilities.java index e21a16b80..9b2a95bea 100644 --- a/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/ServerCapabilities.java +++ b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/ServerCapabilities.java @@ -11,6 +11,7 @@ */ package org.eclipse.lsp4j; +import com.google.common.annotations.Beta; import com.google.gson.annotations.JsonAdapter; import org.eclipse.lsp4j.CodeActionOptions; import org.eclipse.lsp4j.CodeLensOptions; @@ -158,14 +159,32 @@ public class ServerCapabilities { /** * Semantic highlighting server capabilities. */ + @Beta private SemanticHighlightingServerCapabilities semanticHighlighting; /** * Server capability for calculating super- and subtype hierarchies. * The LS supports the type hierarchy language feature, if this capability is set to {@code true}. + * + *

+ * Note: the {@code textDocument/typeHierarchy} + * language feature is not yet part of the official LSP specification. */ + @Beta private Boolean typeHierarchy; + /** + * The server provides Call Hierarchy support. + * + *

+ * Note: the {@code textDocument/callHierarchy} + * language feature is not yet part of the official LSP specification. + */ + @Beta + private Either callHierarchyProvider; + /** * Experimental server capabilities. */ @@ -654,6 +673,11 @@ public void setSemanticHighlighting(final SemanticHighlightingServerCapabilities /** * Server capability for calculating super- and subtype hierarchies. * The LS supports the type hierarchy language feature, if this capability is set to {@code true}. + * + *

+ * Note: the {@code textDocument/typeHierarchy} + * language feature is not yet part of the official LSP specification. */ @Pure public Boolean getTypeHierarchy() { @@ -663,11 +687,57 @@ public Boolean getTypeHierarchy() { /** * Server capability for calculating super- and subtype hierarchies. * The LS supports the type hierarchy language feature, if this capability is set to {@code true}. + * + *

+ * Note: the {@code textDocument/typeHierarchy} + * language feature is not yet part of the official LSP specification. */ public void setTypeHierarchy(final Boolean typeHierarchy) { this.typeHierarchy = typeHierarchy; } + /** + * The server provides Call Hierarchy support. + * + *

+ * Note: the {@code textDocument/callHierarchy} + * language feature is not yet part of the official LSP specification. + */ + @Pure + public Either getCallHierarchyProvider() { + return this.callHierarchyProvider; + } + + /** + * The server provides Call Hierarchy support. + * + *

+ * Note: the {@code textDocument/callHierarchy} + * language feature is not yet part of the official LSP specification. + */ + public void setCallHierarchyProvider(final Either callHierarchyProvider) { + this.callHierarchyProvider = callHierarchyProvider; + } + + public void setCallHierarchyProvider(final Boolean callHierarchyProvider) { + if (callHierarchyProvider == null) { + this.callHierarchyProvider = null; + return; + } + this.callHierarchyProvider = Either.forLeft(callHierarchyProvider); + } + + public void setCallHierarchyProvider(final StaticRegistrationOptions callHierarchyProvider) { + if (callHierarchyProvider == null) { + this.callHierarchyProvider = null; + return; + } + this.callHierarchyProvider = Either.forRight(callHierarchyProvider); + } + /** * Experimental server capabilities. */ @@ -711,6 +781,7 @@ public String toString() { b.add("workspace", this.workspace); b.add("semanticHighlighting", this.semanticHighlighting); b.add("typeHierarchy", this.typeHierarchy); + b.add("callHierarchyProvider", this.callHierarchyProvider); b.add("experimental", this.experimental); return b.toString(); } @@ -845,6 +916,11 @@ public boolean equals(final Object obj) { return false; } else if (!this.typeHierarchy.equals(other.typeHierarchy)) return false; + if (this.callHierarchyProvider == null) { + if (other.callHierarchyProvider != null) + return false; + } else if (!this.callHierarchyProvider.equals(other.callHierarchyProvider)) + return false; if (this.experimental == null) { if (other.experimental != null) return false; @@ -882,6 +958,7 @@ public int hashCode() { result = prime * result + ((this.workspace== null) ? 0 : this.workspace.hashCode()); result = prime * result + ((this.semanticHighlighting== null) ? 0 : this.semanticHighlighting.hashCode()); result = prime * result + ((this.typeHierarchy== null) ? 0 : this.typeHierarchy.hashCode()); + result = prime * result + ((this.callHierarchyProvider== null) ? 0 : this.callHierarchyProvider.hashCode()); return prime * result + ((this.experimental== null) ? 0 : this.experimental.hashCode()); } } diff --git a/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/TextDocumentClientCapabilities.java b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/TextDocumentClientCapabilities.java index 703bf4892..5bcf3822d 100644 --- a/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/TextDocumentClientCapabilities.java +++ b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/TextDocumentClientCapabilities.java @@ -12,6 +12,7 @@ package org.eclipse.lsp4j; import com.google.common.annotations.Beta; +import org.eclipse.lsp4j.CallHierarchyCapabilities; import org.eclipse.lsp4j.CodeActionCapabilities; import org.eclipse.lsp4j.CodeLensCapabilities; import org.eclipse.lsp4j.ColorProviderCapabilities; @@ -160,6 +161,12 @@ public class TextDocumentClientCapabilities { @Beta private TypeHierarchyCapabilities typeHierarchyCapabilities; + /** + * Capabilities specific to {@code textDocument/callHierarchy}. + */ + @Beta + private CallHierarchyCapabilities callHierarchy; + @Pure public SynchronizationCapabilities getSynchronization() { return this.synchronization; @@ -502,6 +509,21 @@ public void setTypeHierarchyCapabilities(final TypeHierarchyCapabilities typeHie this.typeHierarchyCapabilities = typeHierarchyCapabilities; } + /** + * Capabilities specific to {@code textDocument/callHierarchy}. + */ + @Pure + public CallHierarchyCapabilities getCallHierarchy() { + return this.callHierarchy; + } + + /** + * Capabilities specific to {@code textDocument/callHierarchy}. + */ + public void setCallHierarchy(final CallHierarchyCapabilities callHierarchy) { + this.callHierarchy = callHierarchy; + } + @Override @Pure public String toString() { @@ -528,6 +550,7 @@ public String toString() { b.add("foldingRange", this.foldingRange); b.add("semanticHighlightingCapabilities", this.semanticHighlightingCapabilities); b.add("typeHierarchyCapabilities", this.typeHierarchyCapabilities); + b.add("callHierarchy", this.callHierarchy); return b.toString(); } @@ -651,6 +674,11 @@ public boolean equals(final Object obj) { return false; } else if (!this.typeHierarchyCapabilities.equals(other.typeHierarchyCapabilities)) return false; + if (this.callHierarchy == null) { + if (other.callHierarchy != null) + return false; + } else if (!this.callHierarchy.equals(other.callHierarchy)) + return false; return true; } @@ -680,6 +708,7 @@ public int hashCode() { result = prime * result + ((this.publishDiagnostics== null) ? 0 : this.publishDiagnostics.hashCode()); result = prime * result + ((this.foldingRange== null) ? 0 : this.foldingRange.hashCode()); result = prime * result + ((this.semanticHighlightingCapabilities== null) ? 0 : this.semanticHighlightingCapabilities.hashCode()); - return prime * result + ((this.typeHierarchyCapabilities== null) ? 0 : this.typeHierarchyCapabilities.hashCode()); + result = prime * result + ((this.typeHierarchyCapabilities== null) ? 0 : this.typeHierarchyCapabilities.hashCode()); + return prime * result + ((this.callHierarchy== null) ? 0 : this.callHierarchy.hashCode()); } } diff --git a/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/TypeHierarchyCapabilities.java b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/TypeHierarchyCapabilities.java index 2faac3f40..775377503 100644 --- a/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/TypeHierarchyCapabilities.java +++ b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/TypeHierarchyCapabilities.java @@ -18,6 +18,11 @@ /** * Capabilities specific to the {@code textDocument/typeHierarchy} and the {@code typeHierarchy/resolve} * language server methods. + * + *

+ * Note: the {@code textDocument/typeHierarchy} + * language feature is not yet part of the official LSP specification. */ @Beta @SuppressWarnings("all") @@ -27,9 +32,6 @@ public class TypeHierarchyCapabilities { */ private Boolean typeHierarchy; - public TypeHierarchyCapabilities() { - } - public TypeHierarchyCapabilities(final Boolean typeHierarchy) { this.typeHierarchy = typeHierarchy; }