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 68b575ac6..eb3a27e51 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 @@ -720,6 +720,7 @@ class FoldingRangeCapabilities extends DynamicRegistrationCapabilities { /** * Capabilities specific to {@code textDocument/semanticHighlighting}. */ +@Beta @JsonRpcData class SemanticHighlightingCapabilities { /** @@ -735,6 +736,27 @@ class SemanticHighlightingCapabilities { } } +/** + * Capabilities specific to the {@code textDocument/superTypes} and {@code textDocument/subTypes} LS 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. */ @@ -849,7 +871,14 @@ class TextDocumentClientCapabilities { /** * Capabilities specific to {@code textDocument/semanticHighlighting}. */ + @Beta SemanticHighlightingCapabilities semanticHighlightingCapabilities + + /** + * Capabilities specific to {@code textDocument/superTypes} and {@code textDocument/subTypes}. + */ + @Beta + TypeHierarchyCapabilities typeHierarchyCapabilities } /** @@ -2678,7 +2707,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. @@ -2892,6 +2927,15 @@ class DocumentSymbol { @NonNull Range selectionRange + /** + * The URI of the text document this symbol belongs to. + * + *

If not defined, it can be inferred from the context of the request. For example, when calling the {@code textDocument/documentSymbol} + * method, the {@code DocumentUri} (string) can be inferred from the request parameter: {@code DocumentSymbolParams.textDocument.uri}. + */ + @Beta + String uri + /** * More detail for this symbol, e.g the signature of a function. If not provided the * name is used. 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 40170bcb8..ecbe6860e 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 @@ -58,6 +58,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 { @@ -337,7 +339,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: @@ -374,5 +376,29 @@ default CompletableFuture> colorPresentation(ColorPresen default CompletableFuture> foldingRange(FoldingRangeRequestParams params) { throw new UnsupportedOperationException(); } - + + /** + * The {@code textDocument/subTypes} request is sent from the client to the + * server to collect sub-type information for a type under the given + * {@link TextDocumentPositionParams text document position}. If no symbols can be + * found under the given position, returns with {@code null}. + */ + @Beta + @JsonRequest + default CompletableFuture subTypes(TextDocumentPositionParams params) { + throw new UnsupportedOperationException(); + } + + /** + * The {@code textDocument/superTypes} request is sent from the client to the + * server to collect super-type information for a type under the given + * {@link TextDocumentPositionParams text document position}. If no symbols can be + * found under the given position, returns with {@code null}. + */ + @Beta + @JsonRequest + default CompletableFuture superTypes(TextDocumentPositionParams params) { + throw new UnsupportedOperationException(); + } + } diff --git a/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/DocumentSymbol.java b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/DocumentSymbol.java index 79ffba007..a48a253b3 100644 --- a/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/DocumentSymbol.java +++ b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/DocumentSymbol.java @@ -11,6 +11,7 @@ */ package org.eclipse.lsp4j; +import com.google.common.annotations.Beta; import java.util.List; import org.eclipse.lsp4j.Range; import org.eclipse.lsp4j.SymbolKind; @@ -52,6 +53,15 @@ public class DocumentSymbol { @NonNull private Range selectionRange; + /** + * The URI of the text document this symbol belongs to. + * + *

If not defined, it can be inferred from the context of the request. For example, when calling the {@code textDocument/documentSymbol} + * method, the {@code DocumentUri} (string) can be inferred from the request parameter: {@code DocumentSymbolParams.textDocument.uri}. + */ + @Beta + private String uri; + /** * More detail for this symbol, e.g the signature of a function. If not provided the * name is used. @@ -165,6 +175,27 @@ public void setSelectionRange(@NonNull final Range selectionRange) { this.selectionRange = selectionRange; } + /** + * The URI of the text document this symbol belongs to. + * + *

If not defined, it can be inferred from the context of the request. For example, when calling the {@code textDocument/documentSymbol} + * method, the {@code DocumentUri} (string) can be inferred from the request parameter: {@code DocumentSymbolParams.textDocument.uri}. + */ + @Pure + public String getUri() { + return this.uri; + } + + /** + * The URI of the text document this symbol belongs to. + * + *

If not defined, it can be inferred from the context of the request. For example, when calling the {@code textDocument/documentSymbol} + * method, the {@code DocumentUri} (string) can be inferred from the request parameter: {@code DocumentSymbolParams.textDocument.uri}. + */ + public void setUri(final String uri) { + this.uri = uri; + } + /** * More detail for this symbol, e.g the signature of a function. If not provided the * name is used. @@ -220,6 +251,7 @@ public String toString() { b.add("kind", this.kind); b.add("range", this.range); b.add("selectionRange", this.selectionRange); + b.add("uri", this.uri); b.add("detail", this.detail); b.add("deprecated", this.deprecated); b.add("children", this.children); @@ -256,6 +288,11 @@ public boolean equals(final Object obj) { return false; } else if (!this.selectionRange.equals(other.selectionRange)) return false; + if (this.uri == null) { + if (other.uri != null) + return false; + } else if (!this.uri.equals(other.uri)) + return false; if (this.detail == null) { if (other.detail != null) return false; @@ -283,6 +320,7 @@ public int hashCode() { result = prime * result + ((this.kind== null) ? 0 : this.kind.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.uri== null) ? 0 : this.uri.hashCode()); result = prime * result + ((this.detail== null) ? 0 : this.detail.hashCode()); result = prime * result + ((this.deprecated== null) ? 0 : this.deprecated.hashCode()); return prime * result + ((this.children== null) ? 0 : this.children.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 0eba5a6f8..5caea0869 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 @@ -159,6 +159,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. */ @@ -628,6 +634,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. */ @@ -670,6 +693,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(); } @@ -799,6 +823,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; @@ -835,6 +864,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..014ea0171 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/superTypes} and {@code textDocument/subTypes}. + */ + @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/superTypes} and {@code textDocument/subTypes}. + */ + @Pure + public TypeHierarchyCapabilities getTypeHierarchyCapabilities() { + return this.typeHierarchyCapabilities; + } + + /** + * Capabilities specific to {@code textDocument/superTypes} and {@code textDocument/subTypes}. + */ + 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..07025b3a2 --- /dev/null +++ b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/TypeHierarchyCapabilities.java @@ -0,0 +1,82 @@ +/** + * 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/superTypes} and {@code textDocument/subTypes} LS 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()); + } +}