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 4dfca2ab4..1927189a1 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
@@ -752,6 +752,7 @@ class FoldingRangeCapabilities extends DynamicRegistrationCapabilities {
/**
* Capabilities specific to {@code textDocument/semanticHighlighting}.
*/
+@Beta
@JsonRpcData
class SemanticHighlightingCapabilities {
/**
@@ -767,6 +768,28 @@ class SemanticHighlightingCapabilities {
}
}
+/**
+ * Capabilities specific to the {@code textDocument/typeHierarchy} and the {@code typeHierarchy/resolve}
+ * language server methods.
+ */
+@Beta
+@JsonRpcData
+class TypeHierarchyCapabilities {
+
+ /**
+ * The language client supports super- and subtype hierarchies.
+ */
+ Boolean typeHierarchy
+
+ new() {
+ }
+
+ new(Boolean typeHierarchy) {
+ this.typeHierarchy = typeHierarchy
+ }
+
+}
+
/**
* Text document specific client capabilities.
*/
@@ -881,7 +904,14 @@ class TextDocumentClientCapabilities {
/**
* Capabilities specific to {@code textDocument/semanticHighlighting}.
*/
+ @Beta
SemanticHighlightingCapabilities semanticHighlightingCapabilities
+
+ /**
+ * Capabilities specific to {@code textDocument/typeHierarchy}.
+ */
+ @Beta
+ TypeHierarchyCapabilities typeHierarchyCapabilities
}
/**
@@ -1982,6 +2012,70 @@ class DocumentRangeFormattingParams extends DocumentFormattingParams {
}
}
+/**
+ * The type hierarchy request is sent from the client resolve a {@link TypeHierarchyItem type hierarchy item} for
+ * a give cursor location in the text document. The request would also allow to specify if the item should be resolved
+ * and whether sub- or supertypes are to be resolved.
+ */
+@JsonRpcData
+class TypeHierarchyParams extends TextDocumentPositionParams {
+
+ /**
+ * The number of hierarchy levels to resolve. {@code 0} indicates no hierarchy level. It defaults to {@code 0}.
+ */
+ int resolve
+
+ /**
+ * The direction of the type hierarchy resolution. If not defined, defaults to {@code children}.
+ *
+ *
+ * The followings are the legal values:
+ *
+ * - {@code children},
+ * - {@code parents}, and
+ * - {@code both}.
+ *
+ *
+ */
+ String direction
+}
+
+/**
+ * Request to resolve an unresolved {@link TypeHierarchyItem type hierarchy item} which is indicated if the
+ * {@link TypeHierarchyItem#getParents parents} or the {@link TypeHierarchyItem#getChildren children} is not
+ * defined. If resolved and no {@code parents} or {@code children} are available then an empty list is returned.
+ */
+@JsonRpcData
+class ResolveTypeHierarchyItemParams {
+
+ /**
+ * The hierarchy item to resolve.
+ */
+ @NonNull
+ TypeHierarchyItem item
+
+ /**
+ * The number of hierarchy levels to resolve. {@code 0} indicates no hierarchy level.
+ */
+ int resolve
+
+ /**
+ * The direction of the type hierarchy resolution.
+ *
+ *
+ * The followings are the legal values:
+ *
+ * - {@code children},
+ * - {@code parents}, and
+ * - {@code both}.
+ *
+ *
+ */
+ @NonNull
+ String direction
+
+}
+
/**
* The document symbol request is sent from the client to the server to list all symbols found in a given text document.
*/
@@ -2743,7 +2837,13 @@ class ServerCapabilities {
/**
* Semantic highlighting server capabilities.
*/
- SemanticHighlightingServerCapabilities semanticHighlighting;
+ 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}.
+ */
+ Boolean typeHierarchy
/**
* Experimental server capabilities.
@@ -2922,6 +3022,79 @@ class SignatureInformation {
}
}
+/**
+ * Representation of an item that carries type information (such as class, interface, enumeration, etc) with additional parentage details.
+ */
+@JsonRpcData
+class TypeHierarchyItem {
+
+ /**
+ * The human readable name of the hierarchy item.
+ */
+ @NonNull
+ String name
+
+ /**
+ * Optional detail for the hierarchy item. It can be, for instance, the signature of a function or method.
+ */
+ String detail
+
+ /**
+ * The kind of the hierarchy item. For instance, class or interface.
+ */
+ @NonNull
+ SymbolKind kind
+
+ /**
+ * {@code true} if the hierarchy item is deprecated. Otherwise, {@code false}. It is {@code false} by default.
+ */
+ Boolean deprecated
+
+ /**
+ * The URI of the text document where this type hierarchy item belongs to.
+ */
+ @NonNull
+ String uri
+
+ /**
+ * The range enclosing this type hierarchy item 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 type
+ * hierarchy item to reveal in the symbol in the UI.
+ *
+ * @see TypeHierarchyItem#selectionRange
+ */
+ @NonNull
+ Range range
+
+ /**
+ * The range that should be selected and revealed when this type hierarchy item is being picked, e.g the name of a function.
+ * Must be contained by the the {@link TypeHierarchyItem#getRange range}.
+ *
+ * @see TypeHierarchyItem#range
+ */
+ @NonNull
+ Range selectionRange
+
+ /**
+ * If this type hierarchy item is resolved, it contains the direct parents. Could be empty if the item does not have any
+ * direct parents. If not defined, the parents have not been resolved yet.
+ */
+ List parents
+
+ /**
+ * If this type hierarchy item is resolved, it contains the direct children of the current item.
+ * Could be empty if the item does not have any descendants. If not defined, the children have not been resolved.
+ */
+ List children
+
+ /**
+ * An optional data field can be used to identify a type hierarchy item in a resolve request.
+ */
+ @JsonAdapter(JsonElementTypeAdapter.Factory)
+ Object data
+
+}
+
/**
* Represents programming constructs like variables, classes, interfaces etc. that appear in a document. Document symbols can be
* hierarchical and they have two ranges: one that encloses its definition and one that points to its most interesting range,
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 4bcca6144..285830721 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
@@ -47,11 +47,14 @@
import org.eclipse.lsp4j.Range;
import org.eclipse.lsp4j.ReferenceParams;
import org.eclipse.lsp4j.RenameParams;
+import org.eclipse.lsp4j.ResolveTypeHierarchyItemParams;
import org.eclipse.lsp4j.SignatureHelp;
import org.eclipse.lsp4j.SymbolInformation;
import org.eclipse.lsp4j.TextDocumentPositionParams;
import org.eclipse.lsp4j.TextDocumentRegistrationOptions;
import org.eclipse.lsp4j.TextEdit;
+import org.eclipse.lsp4j.TypeHierarchyItem;
+import org.eclipse.lsp4j.TypeHierarchyParams;
import org.eclipse.lsp4j.WillSaveTextDocumentParams;
import org.eclipse.lsp4j.WorkspaceEdit;
import org.eclipse.lsp4j.adapters.CodeActionResponseAdapter;
@@ -63,6 +66,8 @@
import org.eclipse.lsp4j.jsonrpc.services.JsonRequest;
import org.eclipse.lsp4j.jsonrpc.services.JsonSegment;
+import com.google.common.annotations.Beta;
+
@JsonSegment("textDocument")
public interface TextDocumentService {
@@ -353,7 +358,7 @@ default CompletableFuture documentLinkResolve(DocumentLink params)
}
/**
- * The document color request is sent from the client to the server to list all color refereces found in a given text
+ * The document color request is sent from the client to the server to list all color references found in a given text
* document. Along with the range, a color value in RGB is returned.
*
* Clients can use the result to decorate color references in an editor. For example:
@@ -402,4 +407,32 @@ default CompletableFuture> foldingRange(FoldingRangeRequestPa
default CompletableFuture> prepareRename(TextDocumentPositionParams params) {
throw new UnsupportedOperationException();
}
+
+ /**
+ * The {@code textDocument/typeHierarchy} request is sent from the client to the
+ * server to retrieve a {@link TypeHierarchyItem type hierarchy item} based on
+ * the {@link TypeHierarchyParams cursor position in the text document}. This
+ * 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}.
+ */
+ @Beta
+ @JsonRequest
+ default CompletableFuture typeHierarchy(TypeHierarchyParams params) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * The {@code typeHierarchy/resolve} request is sent from the client to the
+ * server to resolve an unresolved {@link TypeHierarchyItem type hierarchy
+ * item}. A type hierarchy item is unresolved if the if the
+ * {@link TypeHierarchyItem#getParents parents} or the
+ * {@link TypeHierarchyItem#getChildren children} is not defined.
+ */
+ @Beta
+ @JsonRequest(value="typeHierarchy/resolve", useSegment = false)
+ default CompletableFuture resolveTypeHierarchy(ResolveTypeHierarchyItemParams params) {
+ throw new UnsupportedOperationException();
+ }
+
}
diff --git a/org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/util/Positions.java b/org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/util/Positions.java
index 20685f9bf..905222330 100644
--- a/org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/util/Positions.java
+++ b/org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/util/Positions.java
@@ -21,7 +21,7 @@
public final class Positions {
/**
- * {@code true} if {@left} is strictly before than {@code right}. Otherwise,
+ * {@code true} if {@code left} is strictly before than {@code right}. Otherwise,
* {@code false}.
*
* If you want to allow equality, use {@link Position#equals}.
diff --git a/org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/util/SemanticHighlightingTokens.java b/org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/util/SemanticHighlightingTokens.java
index 3fbd983e9..675a0e38e 100644
--- a/org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/util/SemanticHighlightingTokens.java
+++ b/org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/util/SemanticHighlightingTokens.java
@@ -131,7 +131,7 @@ public static int[] toIntArray(Iterable extends Token> tokens) {
*
* The elements of the input will be used to create new {@link Token} instances,
* hence they must comply the requirements described
- * {@link #Token(int, int, int) here}.
+ * {@link #SemanticHighlightingTokens.Token(int, int, int) here}.
*/
public static List fromIntArray(int... input) {
if (input == null) {
diff --git a/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/ResolveTypeHierarchyItemParams.java b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/ResolveTypeHierarchyItemParams.java
new file mode 100644
index 000000000..cee63455b
--- /dev/null
+++ b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/ResolveTypeHierarchyItemParams.java
@@ -0,0 +1,161 @@
+/**
+ * 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 org.eclipse.lsp4j.TypeHierarchyItem;
+import org.eclipse.lsp4j.jsonrpc.validation.NonNull;
+import org.eclipse.xtext.xbase.lib.Pure;
+import org.eclipse.xtext.xbase.lib.util.ToStringBuilder;
+
+/**
+ * Request to resolve an unresolved {@link TypeHierarchyItem type hierarchy item} which is indicated if the
+ * {@link TypeHierarchyItem#getParents parents} or the {@link TypeHierarchyItem#getChildren children} is not
+ * defined. If resolved and no {@code parents} or {@code children} are available then an empty list is returned.
+ */
+@SuppressWarnings("all")
+public class ResolveTypeHierarchyItemParams {
+ /**
+ * The hierarchy item to resolve.
+ */
+ @NonNull
+ private TypeHierarchyItem item;
+
+ /**
+ * The number of hierarchy levels to resolve. {@code 0} indicates no hierarchy level.
+ */
+ private int resolve;
+
+ /**
+ * The direction of the type hierarchy resolution.
+ *
+ *
+ * The followings are the legal values:
+ *
+ * - {@code children},
+ * - {@code parents}, and
+ * - {@code both}.
+ *
+ *
+ */
+ @NonNull
+ private String direction;
+
+ /**
+ * The hierarchy item to resolve.
+ */
+ @Pure
+ @NonNull
+ public TypeHierarchyItem getItem() {
+ return this.item;
+ }
+
+ /**
+ * The hierarchy item to resolve.
+ */
+ public void setItem(@NonNull final TypeHierarchyItem item) {
+ this.item = item;
+ }
+
+ /**
+ * The number of hierarchy levels to resolve. {@code 0} indicates no hierarchy level.
+ */
+ @Pure
+ public int getResolve() {
+ return this.resolve;
+ }
+
+ /**
+ * The number of hierarchy levels to resolve. {@code 0} indicates no hierarchy level.
+ */
+ public void setResolve(final int resolve) {
+ this.resolve = resolve;
+ }
+
+ /**
+ * The direction of the type hierarchy resolution.
+ *
+ *
+ * The followings are the legal values:
+ *
+ * - {@code children},
+ * - {@code parents}, and
+ * - {@code both}.
+ *
+ *
+ */
+ @Pure
+ @NonNull
+ public String getDirection() {
+ return this.direction;
+ }
+
+ /**
+ * The direction of the type hierarchy resolution.
+ *
+ *
+ * The followings are the legal values:
+ *
+ * - {@code children},
+ * - {@code parents}, and
+ * - {@code both}.
+ *
+ *
+ */
+ 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;
+ ResolveTypeHierarchyItemParams other = (ResolveTypeHierarchyItemParams) 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 bcfa9ff9f..7f3489407 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
@@ -11,12 +11,14 @@
*/
package org.eclipse.lsp4j;
+import com.google.common.annotations.Beta;
import org.eclipse.xtext.xbase.lib.Pure;
import org.eclipse.xtext.xbase.lib.util.ToStringBuilder;
/**
* Capabilities specific to {@code textDocument/semanticHighlighting}.
*/
+@Beta
@SuppressWarnings("all")
public class SemanticHighlightingCapabilities {
/**
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 9441de846..e21a16b80 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
@@ -160,6 +160,12 @@ public class ServerCapabilities {
*/
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}.
+ */
+ private Boolean typeHierarchy;
+
/**
* Experimental server capabilities.
*/
@@ -645,6 +651,23 @@ public void setSemanticHighlighting(final SemanticHighlightingServerCapabilities
this.semanticHighlighting = 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}.
+ */
+ @Pure
+ public Boolean getTypeHierarchy() {
+ return this.typeHierarchy;
+ }
+
+ /**
+ * Server capability for calculating super- and subtype hierarchies.
+ * The LS supports the type hierarchy language feature, if this capability is set to {@code true}.
+ */
+ public void setTypeHierarchy(final Boolean typeHierarchy) {
+ this.typeHierarchy = typeHierarchy;
+ }
+
/**
* Experimental server capabilities.
*/
@@ -687,6 +710,7 @@ public String toString() {
b.add("executeCommandProvider", this.executeCommandProvider);
b.add("workspace", this.workspace);
b.add("semanticHighlighting", this.semanticHighlighting);
+ b.add("typeHierarchy", this.typeHierarchy);
b.add("experimental", this.experimental);
return b.toString();
}
@@ -816,6 +840,11 @@ public boolean equals(final Object obj) {
return false;
} else if (!this.semanticHighlighting.equals(other.semanticHighlighting))
return false;
+ if (this.typeHierarchy == null) {
+ if (other.typeHierarchy != null)
+ return false;
+ } else if (!this.typeHierarchy.equals(other.typeHierarchy))
+ return false;
if (this.experimental == null) {
if (other.experimental != null)
return false;
@@ -852,6 +881,7 @@ public int hashCode() {
result = prime * result + ((this.executeCommandProvider== null) ? 0 : this.executeCommandProvider.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());
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 f3fce17ef..703bf4892 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
@@ -11,6 +11,7 @@
*/
package org.eclipse.lsp4j;
+import com.google.common.annotations.Beta;
import org.eclipse.lsp4j.CodeActionCapabilities;
import org.eclipse.lsp4j.CodeLensCapabilities;
import org.eclipse.lsp4j.ColorProviderCapabilities;
@@ -32,6 +33,7 @@
import org.eclipse.lsp4j.SignatureHelpCapabilities;
import org.eclipse.lsp4j.SynchronizationCapabilities;
import org.eclipse.lsp4j.TypeDefinitionCapabilities;
+import org.eclipse.lsp4j.TypeHierarchyCapabilities;
import org.eclipse.xtext.xbase.lib.Pure;
import org.eclipse.xtext.xbase.lib.util.ToStringBuilder;
@@ -149,8 +151,15 @@ public class TextDocumentClientCapabilities {
/**
* Capabilities specific to {@code textDocument/semanticHighlighting}.
*/
+ @Beta
private SemanticHighlightingCapabilities semanticHighlightingCapabilities;
+ /**
+ * Capabilities specific to {@code textDocument/typeHierarchy}.
+ */
+ @Beta
+ private TypeHierarchyCapabilities typeHierarchyCapabilities;
+
@Pure
public SynchronizationCapabilities getSynchronization() {
return this.synchronization;
@@ -478,6 +487,21 @@ public void setSemanticHighlightingCapabilities(final SemanticHighlightingCapabi
this.semanticHighlightingCapabilities = semanticHighlightingCapabilities;
}
+ /**
+ * Capabilities specific to {@code textDocument/typeHierarchy}.
+ */
+ @Pure
+ public TypeHierarchyCapabilities getTypeHierarchyCapabilities() {
+ return this.typeHierarchyCapabilities;
+ }
+
+ /**
+ * Capabilities specific to {@code textDocument/typeHierarchy}.
+ */
+ public void setTypeHierarchyCapabilities(final TypeHierarchyCapabilities typeHierarchyCapabilities) {
+ this.typeHierarchyCapabilities = typeHierarchyCapabilities;
+ }
+
@Override
@Pure
public String toString() {
@@ -503,6 +527,7 @@ public String toString() {
b.add("publishDiagnostics", this.publishDiagnostics);
b.add("foldingRange", this.foldingRange);
b.add("semanticHighlightingCapabilities", this.semanticHighlightingCapabilities);
+ b.add("typeHierarchyCapabilities", this.typeHierarchyCapabilities);
return b.toString();
}
@@ -621,6 +646,11 @@ public boolean equals(final Object obj) {
return false;
} else if (!this.semanticHighlightingCapabilities.equals(other.semanticHighlightingCapabilities))
return false;
+ if (this.typeHierarchyCapabilities == null) {
+ if (other.typeHierarchyCapabilities != null)
+ return false;
+ } else if (!this.typeHierarchyCapabilities.equals(other.typeHierarchyCapabilities))
+ return false;
return true;
}
@@ -649,6 +679,7 @@ public int hashCode() {
result = prime * result + ((this.rename== null) ? 0 : this.rename.hashCode());
result = prime * result + ((this.publishDiagnostics== null) ? 0 : this.publishDiagnostics.hashCode());
result = prime * result + ((this.foldingRange== null) ? 0 : this.foldingRange.hashCode());
- return prime * result + ((this.semanticHighlightingCapabilities== null) ? 0 : this.semanticHighlightingCapabilities.hashCode());
+ result = prime * result + ((this.semanticHighlightingCapabilities== null) ? 0 : this.semanticHighlightingCapabilities.hashCode());
+ return prime * result + ((this.typeHierarchyCapabilities== null) ? 0 : this.typeHierarchyCapabilities.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
new file mode 100644
index 000000000..2faac3f40
--- /dev/null
+++ b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/TypeHierarchyCapabilities.java
@@ -0,0 +1,83 @@
+/**
+ * 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.xtext.xbase.lib.Pure;
+import org.eclipse.xtext.xbase.lib.util.ToStringBuilder;
+
+/**
+ * Capabilities specific to the {@code textDocument/typeHierarchy} and the {@code typeHierarchy/resolve}
+ * language server methods.
+ */
+@Beta
+@SuppressWarnings("all")
+public class TypeHierarchyCapabilities {
+ /**
+ * The language client supports super- and subtype hierarchies.
+ */
+ private Boolean typeHierarchy;
+
+ public TypeHierarchyCapabilities() {
+ }
+
+ public TypeHierarchyCapabilities(final Boolean typeHierarchy) {
+ this.typeHierarchy = typeHierarchy;
+ }
+
+ /**
+ * The language client supports super- and subtype hierarchies.
+ */
+ @Pure
+ public Boolean getTypeHierarchy() {
+ return this.typeHierarchy;
+ }
+
+ /**
+ * The language client supports super- and subtype hierarchies.
+ */
+ public void setTypeHierarchy(final Boolean typeHierarchy) {
+ this.typeHierarchy = typeHierarchy;
+ }
+
+ @Override
+ @Pure
+ public String toString() {
+ ToStringBuilder b = new ToStringBuilder(this);
+ b.add("typeHierarchy", this.typeHierarchy);
+ 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;
+ TypeHierarchyCapabilities other = (TypeHierarchyCapabilities) obj;
+ if (this.typeHierarchy == null) {
+ if (other.typeHierarchy != null)
+ return false;
+ } else if (!this.typeHierarchy.equals(other.typeHierarchy))
+ return false;
+ return true;
+ }
+
+ @Override
+ @Pure
+ public int hashCode() {
+ return 31 * 1 + ((this.typeHierarchy== null) ? 0 : this.typeHierarchy.hashCode());
+ }
+}
diff --git a/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/TypeHierarchyItem.java b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/TypeHierarchyItem.java
new file mode 100644
index 000000000..a03868764
--- /dev/null
+++ b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/TypeHierarchyItem.java
@@ -0,0 +1,362 @@
+/**
+ * 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.gson.annotations.JsonAdapter;
+import java.util.List;
+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;
+
+/**
+ * Representation of an item that carries type information (such as class, interface, enumeration, etc) with additional parentage details.
+ */
+@SuppressWarnings("all")
+public class TypeHierarchyItem {
+ /**
+ * The human readable name of the hierarchy item.
+ */
+ @NonNull
+ private String name;
+
+ /**
+ * Optional detail for the hierarchy item. It can be, for instance, the signature of a function or method.
+ */
+ private String detail;
+
+ /**
+ * The kind of the hierarchy item. For instance, class or interface.
+ */
+ @NonNull
+ private SymbolKind kind;
+
+ /**
+ * {@code true} if the hierarchy item is deprecated. Otherwise, {@code false}. It is {@code false} by default.
+ */
+ private Boolean deprecated;
+
+ /**
+ * The URI of the text document where this type hierarchy item belongs to.
+ */
+ @NonNull
+ private String uri;
+
+ /**
+ * The range enclosing this type hierarchy item 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 type
+ * hierarchy item to reveal in the symbol in the UI.
+ *
+ * @see TypeHierarchyItem#selectionRange
+ */
+ @NonNull
+ private Range range;
+
+ /**
+ * The range that should be selected and revealed when this type hierarchy item is being picked, e.g the name of a function.
+ * Must be contained by the the {@link TypeHierarchyItem#getRange range}.
+ *
+ * @see TypeHierarchyItem#range
+ */
+ @NonNull
+ private Range selectionRange;
+
+ /**
+ * If this type hierarchy item is resolved, it contains the direct parents. Could be empty if the item does not have any
+ * direct parents. If not defined, the parents have not been resolved yet.
+ */
+ private List parents;
+
+ /**
+ * If this type hierarchy item is resolved, it contains the direct children of the current item.
+ * Could be empty if the item does not have any descendants. If not defined, the children have not been resolved.
+ */
+ private List children;
+
+ /**
+ * An optional data field can be used to identify a type hierarchy item in a resolve request.
+ */
+ @JsonAdapter(JsonElementTypeAdapter.Factory.class)
+ private Object data;
+
+ /**
+ * The human readable name of the hierarchy item.
+ */
+ @Pure
+ @NonNull
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * The human readable name of the hierarchy item.
+ */
+ public void setName(@NonNull final String name) {
+ this.name = name;
+ }
+
+ /**
+ * Optional detail for the hierarchy item. It can be, for instance, the signature of a function or method.
+ */
+ @Pure
+ public String getDetail() {
+ return this.detail;
+ }
+
+ /**
+ * Optional detail for the hierarchy item. It can be, for instance, the signature of a function or method.
+ */
+ public void setDetail(final String detail) {
+ this.detail = detail;
+ }
+
+ /**
+ * The kind of the hierarchy item. For instance, class or interface.
+ */
+ @Pure
+ @NonNull
+ public SymbolKind getKind() {
+ return this.kind;
+ }
+
+ /**
+ * The kind of the hierarchy item. For instance, class or interface.
+ */
+ public void setKind(@NonNull final SymbolKind kind) {
+ this.kind = kind;
+ }
+
+ /**
+ * {@code true} if the hierarchy item is deprecated. Otherwise, {@code false}. It is {@code false} by default.
+ */
+ @Pure
+ public Boolean getDeprecated() {
+ return this.deprecated;
+ }
+
+ /**
+ * {@code true} if the hierarchy item is deprecated. Otherwise, {@code false}. It is {@code false} by default.
+ */
+ public void setDeprecated(final Boolean deprecated) {
+ this.deprecated = deprecated;
+ }
+
+ /**
+ * The URI of the text document where this type hierarchy item belongs to.
+ */
+ @Pure
+ @NonNull
+ public String getUri() {
+ return this.uri;
+ }
+
+ /**
+ * The URI of the text document where this type hierarchy item belongs to.
+ */
+ public void setUri(@NonNull final String uri) {
+ this.uri = uri;
+ }
+
+ /**
+ * The range enclosing this type hierarchy item 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 type
+ * hierarchy item to reveal in the symbol in the UI.
+ *
+ * @see TypeHierarchyItem#selectionRange
+ */
+ @Pure
+ @NonNull
+ public Range getRange() {
+ return this.range;
+ }
+
+ /**
+ * The range enclosing this type hierarchy item 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 type
+ * hierarchy item to reveal in the symbol in the UI.
+ *
+ * @see TypeHierarchyItem#selectionRange
+ */
+ public void setRange(@NonNull final Range range) {
+ this.range = range;
+ }
+
+ /**
+ * The range that should be selected and revealed when this type hierarchy item is being picked, e.g the name of a function.
+ * Must be contained by the the {@link TypeHierarchyItem#getRange range}.
+ *
+ * @see TypeHierarchyItem#range
+ */
+ @Pure
+ @NonNull
+ public Range getSelectionRange() {
+ return this.selectionRange;
+ }
+
+ /**
+ * The range that should be selected and revealed when this type hierarchy item is being picked, e.g the name of a function.
+ * Must be contained by the the {@link TypeHierarchyItem#getRange range}.
+ *
+ * @see TypeHierarchyItem#range
+ */
+ public void setSelectionRange(@NonNull final Range selectionRange) {
+ this.selectionRange = selectionRange;
+ }
+
+ /**
+ * If this type hierarchy item is resolved, it contains the direct parents. Could be empty if the item does not have any
+ * direct parents. If not defined, the parents have not been resolved yet.
+ */
+ @Pure
+ public List getParents() {
+ return this.parents;
+ }
+
+ /**
+ * If this type hierarchy item is resolved, it contains the direct parents. Could be empty if the item does not have any
+ * direct parents. If not defined, the parents have not been resolved yet.
+ */
+ public void setParents(final List parents) {
+ this.parents = parents;
+ }
+
+ /**
+ * If this type hierarchy item is resolved, it contains the direct children of the current item.
+ * Could be empty if the item does not have any descendants. If not defined, the children have not been resolved.
+ */
+ @Pure
+ public List getChildren() {
+ return this.children;
+ }
+
+ /**
+ * If this type hierarchy item is resolved, it contains the direct children of the current item.
+ * Could be empty if the item does not have any descendants. If not defined, the children have not been resolved.
+ */
+ public void setChildren(final List children) {
+ this.children = children;
+ }
+
+ /**
+ * An optional data field can be used to identify a type hierarchy item in a resolve request.
+ */
+ @Pure
+ public Object getData() {
+ return this.data;
+ }
+
+ /**
+ * An optional data field can be used to identify a type hierarchy 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("deprecated", this.deprecated);
+ b.add("uri", this.uri);
+ b.add("range", this.range);
+ b.add("selectionRange", this.selectionRange);
+ b.add("parents", this.parents);
+ b.add("children", this.children);
+ 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;
+ TypeHierarchyItem other = (TypeHierarchyItem) 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.deprecated == null) {
+ if (other.deprecated != null)
+ return false;
+ } else if (!this.deprecated.equals(other.deprecated))
+ 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.parents == null) {
+ if (other.parents != null)
+ return false;
+ } else if (!this.parents.equals(other.parents))
+ return false;
+ if (this.children == null) {
+ if (other.children != null)
+ return false;
+ } else if (!this.children.equals(other.children))
+ 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.deprecated== null) ? 0 : this.deprecated.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.parents== null) ? 0 : this.parents.hashCode());
+ result = prime * result + ((this.children== null) ? 0 : this.children.hashCode());
+ return prime * result + ((this.data== null) ? 0 : this.data.hashCode());
+ }
+}
diff --git a/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/TypeHierarchyParams.java b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/TypeHierarchyParams.java
new file mode 100644
index 000000000..c1f82e774
--- /dev/null
+++ b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/TypeHierarchyParams.java
@@ -0,0 +1,134 @@
+/**
+ * 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 org.eclipse.lsp4j.TextDocumentPositionParams;
+import org.eclipse.xtext.xbase.lib.Pure;
+import org.eclipse.xtext.xbase.lib.util.ToStringBuilder;
+
+/**
+ * The type hierarchy request is sent from the client resolve a {@link TypeHierarchyItem type hierarchy item} for
+ * a give cursor location in the text document. The request would also allow to specify if the item should be resolved
+ * and whether sub- or supertypes are to be resolved.
+ */
+@SuppressWarnings("all")
+public class TypeHierarchyParams extends TextDocumentPositionParams {
+ /**
+ * The number of hierarchy levels to resolve. {@code 0} indicates no hierarchy level. It defaults to {@code 0}.
+ */
+ private int resolve;
+
+ /**
+ * The direction of the type hierarchy resolution. If not defined, defaults to {@code children}.
+ *
+ *
+ * The followings are the legal values:
+ *
+ * - {@code children},
+ * - {@code parents}, and
+ * - {@code both}.
+ *
+ *
+ */
+ private String direction;
+
+ /**
+ * The number of hierarchy levels to resolve. {@code 0} indicates no hierarchy level. It defaults to {@code 0}.
+ */
+ @Pure
+ public int getResolve() {
+ return this.resolve;
+ }
+
+ /**
+ * The number of hierarchy levels to resolve. {@code 0} indicates no hierarchy level. It defaults to {@code 0}.
+ */
+ public void setResolve(final int resolve) {
+ this.resolve = resolve;
+ }
+
+ /**
+ * The direction of the type hierarchy resolution. If not defined, defaults to {@code children}.
+ *
+ *
+ * The followings are the legal values:
+ *
+ * - {@code children},
+ * - {@code parents}, and
+ * - {@code both}.
+ *
+ *
+ */
+ @Pure
+ public String getDirection() {
+ return this.direction;
+ }
+
+ /**
+ * The direction of the type hierarchy resolution. If not defined, defaults to {@code children}.
+ *
+ *
+ * The followings are the legal values:
+ *
+ * - {@code children},
+ * - {@code parents}, and
+ * - {@code both}.
+ *
+ *
+ */
+ 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;
+ TypeHierarchyParams other = (TypeHierarchyParams) 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());
+ }
+}