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 b9e2d4aa5..a04e454a6 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 @@ -1037,6 +1037,121 @@ class SelectionRangeCapabilities extends DynamicRegistrationCapabilities { super(dynamicRegistration) } } +/** + * @since 3.16.0 + */ +@Beta +@JsonRpcData +class SemanticTokensClientCapabilitiesRequestsFull { + + /** + * The client will send the `textDocument/semanticTokens/full/delta` request if + * the server provides a corresponding handler. + */ + Boolean delta + + new() { + } + + new(Boolean delta) { + this.delta = delta + } +} + +/** + * @since 3.16.0 + */ +@Beta +@JsonRpcData +class SemanticTokensClientCapabilitiesRequests { + + /** + * The client will send the `textDocument/semanticTokens/range` request if + * the server provides a corresponding handler. + */ + Either range + + /** + * The client will send the `textDocument/semanticTokens/full` request if + * the server provides a corresponding handler. + */ + Either full + + new() { + } + + new(Boolean full) { + this.full = full + } + + new(SemanticTokensClientCapabilitiesRequestsFull full) { + this.full = full + } + + new(Boolean full, Boolean range) { + this.full = full + this.range = range + } + + new(SemanticTokensClientCapabilitiesRequestsFull full, Boolean range) { + this.full = full + this.range = range + } + +} + +/** + * @since 3.16.0 + */ +@Beta +@JsonRpcData +class SemanticTokensCapabilities extends DynamicRegistrationCapabilities { + + /** + * Which requests the client supports and might send to the server. + */ + @NonNull + SemanticTokensClientCapabilitiesRequests requests + + /** + * The token types that the client supports. + */ + @NonNull + List tokenTypes; + + /** + * The token modifiers that the client supports. + */ + @NonNull + List tokenModifiers; + + /** + * The formats the clients supports. + */ + @NonNull + List formats; + + new(Boolean dynamicRegistration) { + super(dynamicRegistration) + } + + new(@NonNull SemanticTokensClientCapabilitiesRequests requests, @NonNull List tokenTypes, @NonNull List tokenModifiers, @NonNull List formats) { + this.requests = Preconditions.checkNotNull(requests, 'requests') + this.tokenTypes = Preconditions.checkNotNull(tokenTypes, 'tokenTypes') + this.tokenModifiers = Preconditions.checkNotNull(tokenModifiers, 'tokenModifiers') + this.formats = Preconditions.checkNotNull(formats, 'formats') + } + + + new(Boolean dynamicRegistration, @NonNull SemanticTokensClientCapabilitiesRequests requests, @NonNull List tokenTypes, @NonNull List tokenModifiers, @NonNull List formats) { + super(dynamicRegistration) + this.requests = Preconditions.checkNotNull(requests, 'requests') + this.tokenTypes = Preconditions.checkNotNull(tokenTypes, 'tokenTypes') + this.tokenModifiers = Preconditions.checkNotNull(tokenModifiers, 'tokenModifiers') + this.formats = Preconditions.checkNotNull(formats, 'formats') + } + +} /** * Text document specific client capabilities. @@ -1182,6 +1297,14 @@ class TextDocumentClientCapabilities { * Since 3.15.0 */ SelectionRangeCapabilities selectionRange + + /** + * Capabilities specific to {@code textDocument/semanticTokens}. + * + * @since 3.16.0 + */ + @Beta + SemanticTokensCapabilities semanticTokens } /** @@ -3587,6 +3710,111 @@ class RenameParams extends TextDocumentPositionAndWorkDoneProgressParams { } } +@Beta +@JsonRpcData +class SemanticTokensLegend { + + /** + * The token types that the client supports. + */ + @NonNull + List tokenTypes; + + /** + * The token modifiers that the client supports. + */ + @NonNull + List tokenModifiers; + + new(@NonNull List tokenTypes, @NonNull List tokenModifiers) { + this.tokenTypes = Preconditions.checkNotNull(tokenTypes, 'tokenTypes') + this.tokenModifiers = Preconditions.checkNotNull(tokenModifiers, 'tokenModifiers') + } + +} + +@Beta +@JsonRpcData +class SemanticTokensServerFull { + + /** + * The server supports deltas for full documents. + */ + Boolean delta + + new() { + } + + new(Boolean delta) { + this.delta = delta + } +} + +@Beta +@JsonRpcData +class SemanticTokensWithRegistrationOptions extends AbstractWorkDoneProgressOptions { + + /** + * The legend used by the server + */ + @NonNull + SemanticTokensLegend legend + + /** + * Server supports providing semantic tokens for a specific range + * of a document. + */ + Either range + + /** + * Server supports providing semantic tokens for a full document. + */ + Either full + + /** + * A document selector to identify the scope of the registration. If set to null + * the document selector provided on the client side will be used. + */ + List documentSelector + + new() { + } + + new(@NonNull SemanticTokensLegend legend) { + this.legend = Preconditions.checkNotNull(legend, 'legend') + } + + new(@NonNull SemanticTokensLegend legend, Boolean full) { + this(legend) + this.full = full + } + + new(@NonNull SemanticTokensLegend legend, SemanticTokensServerFull full) { + this(legend) + this.full = full + } + + new(@NonNull SemanticTokensLegend legend, Boolean full, Boolean range) { + this(legend) + this.full = full + this.range = range + } + + new(@NonNull SemanticTokensLegend legend, SemanticTokensServerFull full, Boolean range) { + this(legend) + this.full = full + this.range = range + } + + new(@NonNull SemanticTokensLegend legend, SemanticTokensServerFull full, Boolean range, List documentSelector) { + this(legend) + this.full = full + this.range = range + this.documentSelector = documentSelector + } + +} + @JsonRpcData class ServerCapabilities { /** @@ -3749,6 +3977,14 @@ class ServerCapabilities { */ Either selectionRangeProvider + /** + * The server provides semantic tokens support. + * + * Since 3.16.0 + */ + @Beta + SemanticTokensWithRegistrationOptions semanticTokensProvider + /** * Experimental server capabilities. */ @@ -3853,6 +4089,191 @@ class SignatureHelpParams extends TextDocumentPositionAndWorkDoneProgressParams } } +/** + * @since 3.16.0 + */ +@Beta +@JsonRpcData +class SemanticTokensParams extends WorkDoneProgressAndPartialResultParams { + + /** + * The text document. + */ + @NonNull + TextDocumentIdentifier textDocument + + new(@NonNull TextDocumentIdentifier textDocument) { + this.textDocument = Preconditions.checkNotNull(textDocument, 'textDocument') + } +} + +/** + * @since 3.16.0 + */ +@Beta +@JsonRpcData +class SemanticTokens { + + /** + * An optional result id. If provided and clients support delta updating + * the client will include the result id in the next semantic token request. + * A server can then instead of computing all semantic tokens again simply + * send a delta. + */ + String resultId + + /** + * The actual tokens. + */ + @NonNull + List data + + new(@NonNull List data) { + this.data = Preconditions.checkNotNull(data, 'data') + } + + new(String resultId, @NonNull List data) { + this(data) + this.resultId = resultId + } +} + +/** + * @since 3.16.0 + */ +@Beta +@JsonRpcData +class SemanticTokensPartialResult { + + @NonNull + List data + + new(@NonNull List data) { + this.data = Preconditions.checkNotNull(data, 'data') + } +} + +/** + * @since 3.16.0 + */ +@Beta +@JsonRpcData +class SemanticTokensDeltaParams extends WorkDoneProgressAndPartialResultParams { + + /** + * The text document. + */ + @NonNull + TextDocumentIdentifier textDocument + + /** + * The result id of a previous response. The result Id can either point to a full response + * or a delta response depending on what was recevied last. + */ + @NonNull + String previousResultId + + new(@NonNull TextDocumentIdentifier textDocument, @NonNull String previousResultId) { + this.textDocument = Preconditions.checkNotNull(textDocument, 'textDocument') + this.previousResultId = Preconditions.checkNotNull(previousResultId, 'previousResultId') + } + +} + +/** + * @since 3.16.0 + */ +@Beta +@JsonRpcData +class SemanticTokensEdit { + + /** + * The start offset of the edit. + */ + int start + + /** + * The count of elements to remove. + */ + int deleteCount; + + /** + * The elements to insert. + */ + List data; + + new(int start, int deleteCount, List data) { + this.start = start + this.deleteCount = deleteCount + this.data = data + } +} + +/** + * @since 3.16.0 + */ +@Beta +@JsonRpcData +class SemanticTokensDelta { + + String resultId + + /** + * The semantic token edits to transform a previous result into a new result. + */ + @NonNull + List edits + + new(@NonNull List edits) { + this.edits = Preconditions.checkNotNull(edits, 'edits') + } + + new(@NonNull List edits, String resultId) { + this.edits = Preconditions.checkNotNull(edits, 'edits') + this.resultId = resultId + } +} + +/** + * @since 3.16.0 + */ +@Beta +@JsonRpcData +class SemanticTokensDeltaPartialResult { + + @NonNull + List edits + + new(@NonNull List edits) { + this.edits = Preconditions.checkNotNull(edits, 'edits') + } +} + +/** + * @since 3.16.0 + */ +@Beta +@JsonRpcData +class SemanticTokensRangeParams extends WorkDoneProgressAndPartialResultParams { + + /** + * The text document. + */ + @NonNull + TextDocumentIdentifier textDocument + + /** + * The range the semantic tokens are requested for. + */ + @NonNull + Range range; + + new(@NonNull TextDocumentIdentifier textDocument, @NonNull Range range) { + this.textDocument = Preconditions.checkNotNull(textDocument, 'textDocument') + this.range = Preconditions.checkNotNull(range, 'range') + } +} + /** * Additional information about the context in which a signature help request was triggered. * @@ -6010,6 +6431,3 @@ class WorkDoneProgressCancelParams { this.token = token } } - - - diff --git a/org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/SemanticTokenModifiers.java b/org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/SemanticTokenModifiers.java new file mode 100644 index 000000000..428aaaeb2 --- /dev/null +++ b/org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/SemanticTokenModifiers.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) 2020 Eric Dallo. + * + * 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; + +/** + * @since 3.16.0 + */ +@Beta +public final class SemanticTokenModifiers { + private SemanticTokenModifiers() { + } + + public static final String Declaration = "declaration"; + + public static final String Definition = "definition"; + + public static final String Readonly = "readonly"; + + public static final String Static = "static"; + + public static final String Deprecated = "deprecated"; + + public static final String Abstract = "abstract"; + + public static final String Async = "async"; + + public static final String Modification = "modification"; + + public static final String Documentation = "documentation"; + + public static final String DefaultLibrary = "defaultLibrary"; + +} diff --git a/org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/SemanticTokenTypes.java b/org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/SemanticTokenTypes.java new file mode 100644 index 000000000..f69ab1f69 --- /dev/null +++ b/org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/SemanticTokenTypes.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2020 Eric Dallo. + * + * 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; + +/** + * @since 3.16.0 + */ +@Beta +public final class SemanticTokenTypes { + private SemanticTokenTypes() { + } + + public static final String Namespace = "namespace"; + + public static final String Type = "type"; + + public static final String Class = "class"; + + public static final String Enum = "enum"; + + public static final String Interface = "interface"; + + public static final String Struct = "struct"; + + public static final String TypeParameter = "typeParameter"; + + public static final String Parameter = "parameter"; + + public static final String Variable = "variable"; + + public static final String Property = "property"; + + public static final String EnumMember = "enumMember"; + + public static final String Event = "event"; + + public static final String Function = "function"; + + public static final String Member = "member"; + + public static final String Macro = "macro"; + + public static final String Keyword = "keyword"; + + public static final String Modifier = "modifier"; + + public static final String Comment = "comment"; + + public static final String String = "string"; + + public static final String Number = "number"; + + public static final String Regexp = "regexp"; + + public static final String Operator = "operator"; + +} diff --git a/org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/TokenFormat.java b/org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/TokenFormat.java new file mode 100644 index 000000000..d205960a7 --- /dev/null +++ b/org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/TokenFormat.java @@ -0,0 +1,26 @@ +/** + * Copyright (c) 2020 Eric Dallo. + * + * 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; + +/** + * @since 3.16.0 + */ +@Beta +public final class TokenFormat { + private TokenFormat() { + } + + public static final String Relative = "relative"; + +} diff --git a/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokens.java b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokens.java new file mode 100644 index 000000000..bf46cbd8c --- /dev/null +++ b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokens.java @@ -0,0 +1,127 @@ +/** + * 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 java.util.List; +import org.eclipse.lsp4j.jsonrpc.validation.NonNull; +import org.eclipse.lsp4j.util.Preconditions; +import org.eclipse.xtext.xbase.lib.Pure; +import org.eclipse.xtext.xbase.lib.util.ToStringBuilder; + +/** + * @since 3.16.0 + */ +@Beta +@SuppressWarnings("all") +public class SemanticTokens { + /** + * An optional result id. If provided and clients support delta updating + * the client will include the result id in the next semantic token request. + * A server can then instead of computing all semantic tokens again simply + * send a delta. + */ + private String resultId; + + /** + * The actual tokens. + */ + @NonNull + private List data; + + public SemanticTokens(@NonNull final List data) { + this.data = Preconditions.>checkNotNull(data, "data"); + } + + public SemanticTokens(final String resultId, @NonNull final List data) { + this(data); + this.resultId = resultId; + } + + /** + * An optional result id. If provided and clients support delta updating + * the client will include the result id in the next semantic token request. + * A server can then instead of computing all semantic tokens again simply + * send a delta. + */ + @Pure + public String getResultId() { + return this.resultId; + } + + /** + * An optional result id. If provided and clients support delta updating + * the client will include the result id in the next semantic token request. + * A server can then instead of computing all semantic tokens again simply + * send a delta. + */ + public void setResultId(final String resultId) { + this.resultId = resultId; + } + + /** + * The actual tokens. + */ + @Pure + @NonNull + public List getData() { + return this.data; + } + + /** + * The actual tokens. + */ + public void setData(@NonNull final List data) { + this.data = Preconditions.checkNotNull(data, "data"); + } + + @Override + @Pure + public String toString() { + ToStringBuilder b = new ToStringBuilder(this); + b.add("resultId", this.resultId); + 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; + SemanticTokens other = (SemanticTokens) obj; + if (this.resultId == null) { + if (other.resultId != null) + return false; + } else if (!this.resultId.equals(other.resultId)) + 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.resultId== null) ? 0 : this.resultId.hashCode()); + return prime * result + ((this.data== null) ? 0 : this.data.hashCode()); + } +} diff --git a/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensCapabilities.java b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensCapabilities.java new file mode 100644 index 000000000..fdf888979 --- /dev/null +++ b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensCapabilities.java @@ -0,0 +1,194 @@ +/** + * 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 java.util.List; +import org.eclipse.lsp4j.DynamicRegistrationCapabilities; +import org.eclipse.lsp4j.SemanticTokensClientCapabilitiesRequests; +import org.eclipse.lsp4j.TokenFormat; +import org.eclipse.lsp4j.jsonrpc.validation.NonNull; +import org.eclipse.lsp4j.util.Preconditions; +import org.eclipse.xtext.xbase.lib.Pure; +import org.eclipse.xtext.xbase.lib.util.ToStringBuilder; + +/** + * @since 3.16.0 + */ +@Beta +@SuppressWarnings("all") +public class SemanticTokensCapabilities extends DynamicRegistrationCapabilities { + /** + * Which requests the client supports and might send to the server. + */ + @NonNull + private SemanticTokensClientCapabilitiesRequests requests; + + /** + * The token types that the client supports. + */ + @NonNull + private List tokenTypes; + + /** + * The token modifiers that the client supports. + */ + @NonNull + private List tokenModifiers; + + /** + * The formats the clients supports. + */ + @NonNull + private List formats; + + public SemanticTokensCapabilities(final Boolean dynamicRegistration) { + super(dynamicRegistration); + } + + public SemanticTokensCapabilities(@NonNull final SemanticTokensClientCapabilitiesRequests requests, @NonNull final List tokenTypes, @NonNull final List tokenModifiers, @NonNull final List formats) { + this.requests = Preconditions.checkNotNull(requests, "requests"); + this.tokenTypes = Preconditions.>checkNotNull(tokenTypes, "tokenTypes"); + this.tokenModifiers = Preconditions.>checkNotNull(tokenModifiers, "tokenModifiers"); + this.formats = Preconditions.>checkNotNull(formats, "formats"); + } + + public SemanticTokensCapabilities(final Boolean dynamicRegistration, @NonNull final SemanticTokensClientCapabilitiesRequests requests, @NonNull final List tokenTypes, @NonNull final List tokenModifiers, @NonNull final List formats) { + super(dynamicRegistration); + this.requests = Preconditions.checkNotNull(requests, "requests"); + this.tokenTypes = Preconditions.>checkNotNull(tokenTypes, "tokenTypes"); + this.tokenModifiers = Preconditions.>checkNotNull(tokenModifiers, "tokenModifiers"); + this.formats = Preconditions.>checkNotNull(formats, "formats"); + } + + /** + * Which requests the client supports and might send to the server. + */ + @Pure + @NonNull + public SemanticTokensClientCapabilitiesRequests getRequests() { + return this.requests; + } + + /** + * Which requests the client supports and might send to the server. + */ + public void setRequests(@NonNull final SemanticTokensClientCapabilitiesRequests requests) { + this.requests = Preconditions.checkNotNull(requests, "requests"); + } + + /** + * The token types that the client supports. + */ + @Pure + @NonNull + public List getTokenTypes() { + return this.tokenTypes; + } + + /** + * The token types that the client supports. + */ + public void setTokenTypes(@NonNull final List tokenTypes) { + this.tokenTypes = Preconditions.checkNotNull(tokenTypes, "tokenTypes"); + } + + /** + * The token modifiers that the client supports. + */ + @Pure + @NonNull + public List getTokenModifiers() { + return this.tokenModifiers; + } + + /** + * The token modifiers that the client supports. + */ + public void setTokenModifiers(@NonNull final List tokenModifiers) { + this.tokenModifiers = Preconditions.checkNotNull(tokenModifiers, "tokenModifiers"); + } + + /** + * The formats the clients supports. + */ + @Pure + @NonNull + public List getFormats() { + return this.formats; + } + + /** + * The formats the clients supports. + */ + public void setFormats(@NonNull final List formats) { + this.formats = Preconditions.checkNotNull(formats, "formats"); + } + + @Override + @Pure + public String toString() { + ToStringBuilder b = new ToStringBuilder(this); + b.add("requests", this.requests); + b.add("tokenTypes", this.tokenTypes); + b.add("tokenModifiers", this.tokenModifiers); + b.add("formats", this.formats); + 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; + SemanticTokensCapabilities other = (SemanticTokensCapabilities) obj; + if (this.requests == null) { + if (other.requests != null) + return false; + } else if (!this.requests.equals(other.requests)) + return false; + if (this.tokenTypes == null) { + if (other.tokenTypes != null) + return false; + } else if (!this.tokenTypes.equals(other.tokenTypes)) + return false; + if (this.tokenModifiers == null) { + if (other.tokenModifiers != null) + return false; + } else if (!this.tokenModifiers.equals(other.tokenModifiers)) + return false; + if (this.formats == null) { + if (other.formats != null) + return false; + } else if (!this.formats.equals(other.formats)) + return false; + return true; + } + + @Override + @Pure + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + ((this.requests== null) ? 0 : this.requests.hashCode()); + result = prime * result + ((this.tokenTypes== null) ? 0 : this.tokenTypes.hashCode()); + result = prime * result + ((this.tokenModifiers== null) ? 0 : this.tokenModifiers.hashCode()); + return prime * result + ((this.formats== null) ? 0 : this.formats.hashCode()); + } +} diff --git a/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensClientCapabilitiesRequests.java b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensClientCapabilitiesRequests.java new file mode 100644 index 000000000..85175ca19 --- /dev/null +++ b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensClientCapabilitiesRequests.java @@ -0,0 +1,165 @@ +/** + * 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.SemanticTokensClientCapabilitiesRequestsFull; +import org.eclipse.lsp4j.jsonrpc.messages.Either; +import org.eclipse.xtext.xbase.lib.Pure; +import org.eclipse.xtext.xbase.lib.util.ToStringBuilder; + +/** + * @since 3.16.0 + */ +@Beta +@SuppressWarnings("all") +public class SemanticTokensClientCapabilitiesRequests { + /** + * The client will send the `textDocument/semanticTokens/range` request if + * the server provides a corresponding handler. + */ + private Either range; + + /** + * The client will send the `textDocument/semanticTokens/full` request if + * the server provides a corresponding handler. + */ + private Either full; + + public SemanticTokensClientCapabilitiesRequests() { + } + + public SemanticTokensClientCapabilitiesRequests(final Boolean full) { + this.setFull(full); + } + + public SemanticTokensClientCapabilitiesRequests(final SemanticTokensClientCapabilitiesRequestsFull full) { + this.setFull(full); + } + + public SemanticTokensClientCapabilitiesRequests(final Boolean full, final Boolean range) { + this.setFull(full); + this.setRange(range); + } + + public SemanticTokensClientCapabilitiesRequests(final SemanticTokensClientCapabilitiesRequestsFull full, final Boolean range) { + this.setFull(full); + this.setRange(range); + } + + /** + * The client will send the `textDocument/semanticTokens/range` request if + * the server provides a corresponding handler. + */ + @Pure + public Either getRange() { + return this.range; + } + + /** + * The client will send the `textDocument/semanticTokens/range` request if + * the server provides a corresponding handler. + */ + public void setRange(final Either range) { + this.range = range; + } + + public void setRange(final Boolean range) { + if (range == null) { + this.range = null; + return; + } + this.range = Either.forLeft(range); + } + + public void setRange(final Object range) { + if (range == null) { + this.range = null; + return; + } + this.range = Either.forRight(range); + } + + /** + * The client will send the `textDocument/semanticTokens/full` request if + * the server provides a corresponding handler. + */ + @Pure + public Either getFull() { + return this.full; + } + + /** + * The client will send the `textDocument/semanticTokens/full` request if + * the server provides a corresponding handler. + */ + public void setFull(final Either full) { + this.full = full; + } + + public void setFull(final Boolean full) { + if (full == null) { + this.full = null; + return; + } + this.full = Either.forLeft(full); + } + + public void setFull(final SemanticTokensClientCapabilitiesRequestsFull full) { + if (full == null) { + this.full = null; + return; + } + this.full = Either.forRight(full); + } + + @Override + @Pure + public String toString() { + ToStringBuilder b = new ToStringBuilder(this); + b.add("range", this.range); + b.add("full", this.full); + 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; + SemanticTokensClientCapabilitiesRequests other = (SemanticTokensClientCapabilitiesRequests) obj; + if (this.range == null) { + if (other.range != null) + return false; + } else if (!this.range.equals(other.range)) + return false; + if (this.full == null) { + if (other.full != null) + return false; + } else if (!this.full.equals(other.full)) + return false; + return true; + } + + @Override + @Pure + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.range== null) ? 0 : this.range.hashCode()); + return prime * result + ((this.full== null) ? 0 : this.full.hashCode()); + } +} diff --git a/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensClientCapabilitiesRequestsFull.java b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensClientCapabilitiesRequestsFull.java new file mode 100644 index 000000000..bd650baf3 --- /dev/null +++ b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensClientCapabilitiesRequestsFull.java @@ -0,0 +1,85 @@ +/** + * 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; + +/** + * @since 3.16.0 + */ +@Beta +@SuppressWarnings("all") +public class SemanticTokensClientCapabilitiesRequestsFull { + /** + * The client will send the `textDocument/semanticTokens/full/delta` request if + * the server provides a corresponding handler. + */ + private Boolean delta; + + public SemanticTokensClientCapabilitiesRequestsFull() { + } + + public SemanticTokensClientCapabilitiesRequestsFull(final Boolean delta) { + this.delta = delta; + } + + /** + * The client will send the `textDocument/semanticTokens/full/delta` request if + * the server provides a corresponding handler. + */ + @Pure + public Boolean getDelta() { + return this.delta; + } + + /** + * The client will send the `textDocument/semanticTokens/full/delta` request if + * the server provides a corresponding handler. + */ + public void setDelta(final Boolean delta) { + this.delta = delta; + } + + @Override + @Pure + public String toString() { + ToStringBuilder b = new ToStringBuilder(this); + b.add("delta", this.delta); + 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; + SemanticTokensClientCapabilitiesRequestsFull other = (SemanticTokensClientCapabilitiesRequestsFull) obj; + if (this.delta == null) { + if (other.delta != null) + return false; + } else if (!this.delta.equals(other.delta)) + return false; + return true; + } + + @Override + @Pure + public int hashCode() { + return 31 * 1 + ((this.delta== null) ? 0 : this.delta.hashCode()); + } +} diff --git a/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensDelta.java b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensDelta.java new file mode 100644 index 000000000..8e7d1b84a --- /dev/null +++ b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensDelta.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 java.util.List; +import org.eclipse.lsp4j.SemanticTokensEdit; +import org.eclipse.lsp4j.jsonrpc.validation.NonNull; +import org.eclipse.lsp4j.util.Preconditions; +import org.eclipse.xtext.xbase.lib.Pure; +import org.eclipse.xtext.xbase.lib.util.ToStringBuilder; + +/** + * @since 3.16.0 + */ +@Beta +@SuppressWarnings("all") +public class SemanticTokensDelta { + private String resultId; + + /** + * The semantic token edits to transform a previous result into a new result. + */ + @NonNull + private List edits; + + public SemanticTokensDelta(@NonNull final List edits) { + this.edits = Preconditions.>checkNotNull(edits, "edits"); + } + + public SemanticTokensDelta(@NonNull final List edits, final String resultId) { + this.edits = Preconditions.>checkNotNull(edits, "edits"); + this.resultId = resultId; + } + + @Pure + public String getResultId() { + return this.resultId; + } + + public void setResultId(final String resultId) { + this.resultId = resultId; + } + + /** + * The semantic token edits to transform a previous result into a new result. + */ + @Pure + @NonNull + public List getEdits() { + return this.edits; + } + + /** + * The semantic token edits to transform a previous result into a new result. + */ + public void setEdits(@NonNull final List edits) { + this.edits = Preconditions.checkNotNull(edits, "edits"); + } + + @Override + @Pure + public String toString() { + ToStringBuilder b = new ToStringBuilder(this); + b.add("resultId", this.resultId); + b.add("edits", this.edits); + 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; + SemanticTokensDelta other = (SemanticTokensDelta) obj; + if (this.resultId == null) { + if (other.resultId != null) + return false; + } else if (!this.resultId.equals(other.resultId)) + return false; + if (this.edits == null) { + if (other.edits != null) + return false; + } else if (!this.edits.equals(other.edits)) + return false; + return true; + } + + @Override + @Pure + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.resultId== null) ? 0 : this.resultId.hashCode()); + return prime * result + ((this.edits== null) ? 0 : this.edits.hashCode()); + } +} diff --git a/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensDeltaParams.java b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensDeltaParams.java new file mode 100644 index 000000000..64fe8195a --- /dev/null +++ b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensDeltaParams.java @@ -0,0 +1,124 @@ +/** + * 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.TextDocumentIdentifier; +import org.eclipse.lsp4j.WorkDoneProgressAndPartialResultParams; +import org.eclipse.lsp4j.jsonrpc.validation.NonNull; +import org.eclipse.lsp4j.util.Preconditions; +import org.eclipse.xtext.xbase.lib.Pure; +import org.eclipse.xtext.xbase.lib.util.ToStringBuilder; + +/** + * @since 3.16.0 + */ +@Beta +@SuppressWarnings("all") +public class SemanticTokensDeltaParams extends WorkDoneProgressAndPartialResultParams { + /** + * The text document. + */ + @NonNull + private TextDocumentIdentifier textDocument; + + /** + * The result id of a previous response. The result Id can either point to a full response + * or a delta response depending on what was recevied last. + */ + @NonNull + private String previousResultId; + + public SemanticTokensDeltaParams(@NonNull final TextDocumentIdentifier textDocument, @NonNull final String previousResultId) { + this.textDocument = Preconditions.checkNotNull(textDocument, "textDocument"); + this.previousResultId = Preconditions.checkNotNull(previousResultId, "previousResultId"); + } + + /** + * The text document. + */ + @Pure + @NonNull + public TextDocumentIdentifier getTextDocument() { + return this.textDocument; + } + + /** + * The text document. + */ + public void setTextDocument(@NonNull final TextDocumentIdentifier textDocument) { + this.textDocument = Preconditions.checkNotNull(textDocument, "textDocument"); + } + + /** + * The result id of a previous response. The result Id can either point to a full response + * or a delta response depending on what was recevied last. + */ + @Pure + @NonNull + public String getPreviousResultId() { + return this.previousResultId; + } + + /** + * The result id of a previous response. The result Id can either point to a full response + * or a delta response depending on what was recevied last. + */ + public void setPreviousResultId(@NonNull final String previousResultId) { + this.previousResultId = Preconditions.checkNotNull(previousResultId, "previousResultId"); + } + + @Override + @Pure + public String toString() { + ToStringBuilder b = new ToStringBuilder(this); + b.add("textDocument", this.textDocument); + b.add("previousResultId", this.previousResultId); + b.add("workDoneToken", getWorkDoneToken()); + b.add("partialResultToken", getPartialResultToken()); + 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; + SemanticTokensDeltaParams other = (SemanticTokensDeltaParams) obj; + if (this.textDocument == null) { + if (other.textDocument != null) + return false; + } else if (!this.textDocument.equals(other.textDocument)) + return false; + if (this.previousResultId == null) { + if (other.previousResultId != null) + return false; + } else if (!this.previousResultId.equals(other.previousResultId)) + return false; + return true; + } + + @Override + @Pure + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + ((this.textDocument== null) ? 0 : this.textDocument.hashCode()); + return prime * result + ((this.previousResultId== null) ? 0 : this.previousResultId.hashCode()); + } +} diff --git a/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensDeltaPartialResult.java b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensDeltaPartialResult.java new file mode 100644 index 000000000..7386b1297 --- /dev/null +++ b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensDeltaPartialResult.java @@ -0,0 +1,76 @@ +/** + * 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 java.util.List; +import org.eclipse.lsp4j.SemanticTokensEdit; +import org.eclipse.lsp4j.jsonrpc.validation.NonNull; +import org.eclipse.lsp4j.util.Preconditions; +import org.eclipse.xtext.xbase.lib.Pure; +import org.eclipse.xtext.xbase.lib.util.ToStringBuilder; + +/** + * @since 3.16.0 + */ +@Beta +@SuppressWarnings("all") +public class SemanticTokensDeltaPartialResult { + @NonNull + private List edits; + + public SemanticTokensDeltaPartialResult(@NonNull final List edits) { + this.edits = Preconditions.>checkNotNull(edits, "edits"); + } + + @Pure + @NonNull + public List getEdits() { + return this.edits; + } + + public void setEdits(@NonNull final List edits) { + this.edits = Preconditions.checkNotNull(edits, "edits"); + } + + @Override + @Pure + public String toString() { + ToStringBuilder b = new ToStringBuilder(this); + b.add("edits", this.edits); + 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; + SemanticTokensDeltaPartialResult other = (SemanticTokensDeltaPartialResult) obj; + if (this.edits == null) { + if (other.edits != null) + return false; + } else if (!this.edits.equals(other.edits)) + return false; + return true; + } + + @Override + @Pure + public int hashCode() { + return 31 * 1 + ((this.edits== null) ? 0 : this.edits.hashCode()); + } +} diff --git a/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensEdit.java b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensEdit.java new file mode 100644 index 000000000..a18d151a6 --- /dev/null +++ b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensEdit.java @@ -0,0 +1,132 @@ +/** + * 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 java.util.List; +import org.eclipse.xtext.xbase.lib.Pure; +import org.eclipse.xtext.xbase.lib.util.ToStringBuilder; + +/** + * @since 3.16.0 + */ +@Beta +@SuppressWarnings("all") +public class SemanticTokensEdit { + /** + * The start offset of the edit. + */ + private int start; + + /** + * The count of elements to remove. + */ + private int deleteCount; + + /** + * The elements to insert. + */ + private List data; + + public SemanticTokensEdit(final int start, final int deleteCount, final List data) { + this.start = start; + this.deleteCount = deleteCount; + this.data = data; + } + + /** + * The start offset of the edit. + */ + @Pure + public int getStart() { + return this.start; + } + + /** + * The start offset of the edit. + */ + public void setStart(final int start) { + this.start = start; + } + + /** + * The count of elements to remove. + */ + @Pure + public int getDeleteCount() { + return this.deleteCount; + } + + /** + * The count of elements to remove. + */ + public void setDeleteCount(final int deleteCount) { + this.deleteCount = deleteCount; + } + + /** + * The elements to insert. + */ + @Pure + public List getData() { + return this.data; + } + + /** + * The elements to insert. + */ + public void setData(final List data) { + this.data = data; + } + + @Override + @Pure + public String toString() { + ToStringBuilder b = new ToStringBuilder(this); + b.add("start", this.start); + b.add("deleteCount", this.deleteCount); + 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; + SemanticTokensEdit other = (SemanticTokensEdit) obj; + if (other.start != this.start) + return false; + if (other.deleteCount != this.deleteCount) + 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.start; + result = prime * result + this.deleteCount; + return prime * result + ((this.data== null) ? 0 : this.data.hashCode()); + } +} diff --git a/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensLegend.java b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensLegend.java new file mode 100644 index 000000000..936294fb1 --- /dev/null +++ b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensLegend.java @@ -0,0 +1,113 @@ +/** + * 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 java.util.List; +import org.eclipse.lsp4j.jsonrpc.validation.NonNull; +import org.eclipse.lsp4j.util.Preconditions; +import org.eclipse.xtext.xbase.lib.Pure; +import org.eclipse.xtext.xbase.lib.util.ToStringBuilder; + +@Beta +@SuppressWarnings("all") +public class SemanticTokensLegend { + /** + * The token types that the client supports. + */ + @NonNull + private List tokenTypes; + + /** + * The token modifiers that the client supports. + */ + @NonNull + private List tokenModifiers; + + public SemanticTokensLegend(@NonNull final List tokenTypes, @NonNull final List tokenModifiers) { + this.tokenTypes = Preconditions.>checkNotNull(tokenTypes, "tokenTypes"); + this.tokenModifiers = Preconditions.>checkNotNull(tokenModifiers, "tokenModifiers"); + } + + /** + * The token types that the client supports. + */ + @Pure + @NonNull + public List getTokenTypes() { + return this.tokenTypes; + } + + /** + * The token types that the client supports. + */ + public void setTokenTypes(@NonNull final List tokenTypes) { + this.tokenTypes = Preconditions.checkNotNull(tokenTypes, "tokenTypes"); + } + + /** + * The token modifiers that the client supports. + */ + @Pure + @NonNull + public List getTokenModifiers() { + return this.tokenModifiers; + } + + /** + * The token modifiers that the client supports. + */ + public void setTokenModifiers(@NonNull final List tokenModifiers) { + this.tokenModifiers = Preconditions.checkNotNull(tokenModifiers, "tokenModifiers"); + } + + @Override + @Pure + public String toString() { + ToStringBuilder b = new ToStringBuilder(this); + b.add("tokenTypes", this.tokenTypes); + b.add("tokenModifiers", this.tokenModifiers); + 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; + SemanticTokensLegend other = (SemanticTokensLegend) obj; + if (this.tokenTypes == null) { + if (other.tokenTypes != null) + return false; + } else if (!this.tokenTypes.equals(other.tokenTypes)) + return false; + if (this.tokenModifiers == null) { + if (other.tokenModifiers != null) + return false; + } else if (!this.tokenModifiers.equals(other.tokenModifiers)) + return false; + return true; + } + + @Override + @Pure + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.tokenTypes== null) ? 0 : this.tokenTypes.hashCode()); + return prime * result + ((this.tokenModifiers== null) ? 0 : this.tokenModifiers.hashCode()); + } +} diff --git a/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensParams.java b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensParams.java new file mode 100644 index 000000000..78d870597 --- /dev/null +++ b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensParams.java @@ -0,0 +1,89 @@ +/** + * 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.TextDocumentIdentifier; +import org.eclipse.lsp4j.WorkDoneProgressAndPartialResultParams; +import org.eclipse.lsp4j.jsonrpc.validation.NonNull; +import org.eclipse.lsp4j.util.Preconditions; +import org.eclipse.xtext.xbase.lib.Pure; +import org.eclipse.xtext.xbase.lib.util.ToStringBuilder; + +/** + * @since 3.16.0 + */ +@Beta +@SuppressWarnings("all") +public class SemanticTokensParams extends WorkDoneProgressAndPartialResultParams { + /** + * The text document. + */ + @NonNull + private TextDocumentIdentifier textDocument; + + public SemanticTokensParams(@NonNull final TextDocumentIdentifier textDocument) { + this.textDocument = Preconditions.checkNotNull(textDocument, "textDocument"); + } + + /** + * The text document. + */ + @Pure + @NonNull + public TextDocumentIdentifier getTextDocument() { + return this.textDocument; + } + + /** + * The text document. + */ + public void setTextDocument(@NonNull final TextDocumentIdentifier textDocument) { + this.textDocument = Preconditions.checkNotNull(textDocument, "textDocument"); + } + + @Override + @Pure + public String toString() { + ToStringBuilder b = new ToStringBuilder(this); + b.add("textDocument", this.textDocument); + b.add("workDoneToken", getWorkDoneToken()); + b.add("partialResultToken", getPartialResultToken()); + 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; + SemanticTokensParams other = (SemanticTokensParams) obj; + if (this.textDocument == null) { + if (other.textDocument != null) + return false; + } else if (!this.textDocument.equals(other.textDocument)) + return false; + return true; + } + + @Override + @Pure + public int hashCode() { + return 31 * super.hashCode() + ((this.textDocument== null) ? 0 : this.textDocument.hashCode()); + } +} diff --git a/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensPartialResult.java b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensPartialResult.java new file mode 100644 index 000000000..aee16df76 --- /dev/null +++ b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensPartialResult.java @@ -0,0 +1,75 @@ +/** + * 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 java.util.List; +import org.eclipse.lsp4j.jsonrpc.validation.NonNull; +import org.eclipse.lsp4j.util.Preconditions; +import org.eclipse.xtext.xbase.lib.Pure; +import org.eclipse.xtext.xbase.lib.util.ToStringBuilder; + +/** + * @since 3.16.0 + */ +@Beta +@SuppressWarnings("all") +public class SemanticTokensPartialResult { + @NonNull + private List data; + + public SemanticTokensPartialResult(@NonNull final List data) { + this.data = Preconditions.>checkNotNull(data, "data"); + } + + @Pure + @NonNull + public List getData() { + return this.data; + } + + public void setData(@NonNull final List data) { + this.data = Preconditions.checkNotNull(data, "data"); + } + + @Override + @Pure + public String toString() { + ToStringBuilder b = new ToStringBuilder(this); + 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; + SemanticTokensPartialResult other = (SemanticTokensPartialResult) obj; + 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() { + return 31 * 1 + ((this.data== null) ? 0 : this.data.hashCode()); + } +} diff --git a/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensRangeParams.java b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensRangeParams.java new file mode 100644 index 000000000..a50602495 --- /dev/null +++ b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensRangeParams.java @@ -0,0 +1,122 @@ +/** + * 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.Range; +import org.eclipse.lsp4j.TextDocumentIdentifier; +import org.eclipse.lsp4j.WorkDoneProgressAndPartialResultParams; +import org.eclipse.lsp4j.jsonrpc.validation.NonNull; +import org.eclipse.lsp4j.util.Preconditions; +import org.eclipse.xtext.xbase.lib.Pure; +import org.eclipse.xtext.xbase.lib.util.ToStringBuilder; + +/** + * @since 3.16.0 + */ +@Beta +@SuppressWarnings("all") +public class SemanticTokensRangeParams extends WorkDoneProgressAndPartialResultParams { + /** + * The text document. + */ + @NonNull + private TextDocumentIdentifier textDocument; + + /** + * The range the semantic tokens are requested for. + */ + @NonNull + private Range range; + + public SemanticTokensRangeParams(@NonNull final TextDocumentIdentifier textDocument, @NonNull final Range range) { + this.textDocument = Preconditions.checkNotNull(textDocument, "textDocument"); + this.range = Preconditions.checkNotNull(range, "range"); + } + + /** + * The text document. + */ + @Pure + @NonNull + public TextDocumentIdentifier getTextDocument() { + return this.textDocument; + } + + /** + * The text document. + */ + public void setTextDocument(@NonNull final TextDocumentIdentifier textDocument) { + this.textDocument = Preconditions.checkNotNull(textDocument, "textDocument"); + } + + /** + * The range the semantic tokens are requested for. + */ + @Pure + @NonNull + public Range getRange() { + return this.range; + } + + /** + * The range the semantic tokens are requested for. + */ + public void setRange(@NonNull final Range range) { + this.range = Preconditions.checkNotNull(range, "range"); + } + + @Override + @Pure + public String toString() { + ToStringBuilder b = new ToStringBuilder(this); + b.add("textDocument", this.textDocument); + b.add("range", this.range); + b.add("workDoneToken", getWorkDoneToken()); + b.add("partialResultToken", getPartialResultToken()); + 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; + SemanticTokensRangeParams other = (SemanticTokensRangeParams) obj; + if (this.textDocument == null) { + if (other.textDocument != null) + return false; + } else if (!this.textDocument.equals(other.textDocument)) + return false; + if (this.range == null) { + if (other.range != null) + return false; + } else if (!this.range.equals(other.range)) + return false; + return true; + } + + @Override + @Pure + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + ((this.textDocument== null) ? 0 : this.textDocument.hashCode()); + return prime * result + ((this.range== null) ? 0 : this.range.hashCode()); + } +} diff --git a/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensServerFull.java b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensServerFull.java new file mode 100644 index 000000000..78aa835b3 --- /dev/null +++ b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensServerFull.java @@ -0,0 +1,79 @@ +/** + * 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; + +@Beta +@SuppressWarnings("all") +public class SemanticTokensServerFull { + /** + * The server supports deltas for full documents. + */ + private Boolean delta; + + public SemanticTokensServerFull() { + } + + public SemanticTokensServerFull(final Boolean delta) { + this.delta = delta; + } + + /** + * The server supports deltas for full documents. + */ + @Pure + public Boolean getDelta() { + return this.delta; + } + + /** + * The server supports deltas for full documents. + */ + public void setDelta(final Boolean delta) { + this.delta = delta; + } + + @Override + @Pure + public String toString() { + ToStringBuilder b = new ToStringBuilder(this); + b.add("delta", this.delta); + 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; + SemanticTokensServerFull other = (SemanticTokensServerFull) obj; + if (this.delta == null) { + if (other.delta != null) + return false; + } else if (!this.delta.equals(other.delta)) + return false; + return true; + } + + @Override + @Pure + public int hashCode() { + return 31 * 1 + ((this.delta== null) ? 0 : this.delta.hashCode()); + } +} diff --git a/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensWithRegistrationOptions.java b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensWithRegistrationOptions.java new file mode 100644 index 000000000..93c2c8312 --- /dev/null +++ b/org.eclipse.lsp4j/src/main/xtend-gen/org/eclipse/lsp4j/SemanticTokensWithRegistrationOptions.java @@ -0,0 +1,242 @@ +/** + * 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 java.util.List; +import org.eclipse.lsp4j.AbstractWorkDoneProgressOptions; +import org.eclipse.lsp4j.DocumentFilter; +import org.eclipse.lsp4j.SemanticTokensLegend; +import org.eclipse.lsp4j.SemanticTokensServerFull; +import org.eclipse.lsp4j.jsonrpc.messages.Either; +import org.eclipse.lsp4j.jsonrpc.validation.NonNull; +import org.eclipse.lsp4j.util.Preconditions; +import org.eclipse.xtext.xbase.lib.Pure; +import org.eclipse.xtext.xbase.lib.util.ToStringBuilder; + +@Beta +@SuppressWarnings("all") +public class SemanticTokensWithRegistrationOptions extends AbstractWorkDoneProgressOptions { + /** + * The legend used by the server + */ + @NonNull + private SemanticTokensLegend legend; + + /** + * Server supports providing semantic tokens for a specific range + * of a document. + */ + private Either range; + + /** + * Server supports providing semantic tokens for a full document. + */ + private Either full; + + /** + * A document selector to identify the scope of the registration. If set to null + * the document selector provided on the client side will be used. + */ + private List documentSelector; + + public SemanticTokensWithRegistrationOptions() { + } + + public SemanticTokensWithRegistrationOptions(@NonNull final SemanticTokensLegend legend) { + this.legend = Preconditions.checkNotNull(legend, "legend"); + } + + public SemanticTokensWithRegistrationOptions(@NonNull final SemanticTokensLegend legend, final Boolean full) { + this(legend); + this.setFull(full); + } + + public SemanticTokensWithRegistrationOptions(@NonNull final SemanticTokensLegend legend, final SemanticTokensServerFull full) { + this(legend); + this.setFull(full); + } + + public SemanticTokensWithRegistrationOptions(@NonNull final SemanticTokensLegend legend, final Boolean full, final Boolean range) { + this(legend); + this.setFull(full); + this.setRange(range); + } + + public SemanticTokensWithRegistrationOptions(@NonNull final SemanticTokensLegend legend, final SemanticTokensServerFull full, final Boolean range) { + this(legend); + this.setFull(full); + this.setRange(range); + } + + public SemanticTokensWithRegistrationOptions(@NonNull final SemanticTokensLegend legend, final SemanticTokensServerFull full, final Boolean range, final List documentSelector) { + this(legend); + this.setFull(full); + this.setRange(range); + this.documentSelector = documentSelector; + } + + /** + * The legend used by the server + */ + @Pure + @NonNull + public SemanticTokensLegend getLegend() { + return this.legend; + } + + /** + * The legend used by the server + */ + public void setLegend(@NonNull final SemanticTokensLegend legend) { + this.legend = Preconditions.checkNotNull(legend, "legend"); + } + + /** + * Server supports providing semantic tokens for a specific range + * of a document. + */ + @Pure + public Either getRange() { + return this.range; + } + + /** + * Server supports providing semantic tokens for a specific range + * of a document. + */ + public void setRange(final Either range) { + this.range = range; + } + + public void setRange(final Boolean range) { + if (range == null) { + this.range = null; + return; + } + this.range = Either.forLeft(range); + } + + public void setRange(final Object range) { + if (range == null) { + this.range = null; + return; + } + this.range = Either.forRight(range); + } + + /** + * Server supports providing semantic tokens for a full document. + */ + @Pure + public Either getFull() { + return this.full; + } + + /** + * Server supports providing semantic tokens for a full document. + */ + public void setFull(final Either full) { + this.full = full; + } + + public void setFull(final Boolean full) { + if (full == null) { + this.full = null; + return; + } + this.full = Either.forLeft(full); + } + + public void setFull(final SemanticTokensServerFull full) { + if (full == null) { + this.full = null; + return; + } + this.full = Either.forRight(full); + } + + /** + * A document selector to identify the scope of the registration. If set to null + * the document selector provided on the client side will be used. + */ + @Pure + public List getDocumentSelector() { + return this.documentSelector; + } + + /** + * A document selector to identify the scope of the registration. If set to null + * the document selector provided on the client side will be used. + */ + public void setDocumentSelector(final List documentSelector) { + this.documentSelector = documentSelector; + } + + @Override + @Pure + public String toString() { + ToStringBuilder b = new ToStringBuilder(this); + b.add("legend", this.legend); + b.add("range", this.range); + b.add("full", this.full); + b.add("documentSelector", this.documentSelector); + b.add("workDoneProgress", getWorkDoneProgress()); + 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; + SemanticTokensWithRegistrationOptions other = (SemanticTokensWithRegistrationOptions) obj; + if (this.legend == null) { + if (other.legend != null) + return false; + } else if (!this.legend.equals(other.legend)) + return false; + if (this.range == null) { + if (other.range != null) + return false; + } else if (!this.range.equals(other.range)) + return false; + if (this.full == null) { + if (other.full != null) + return false; + } else if (!this.full.equals(other.full)) + return false; + if (this.documentSelector == null) { + if (other.documentSelector != null) + return false; + } else if (!this.documentSelector.equals(other.documentSelector)) + return false; + return true; + } + + @Override + @Pure + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + ((this.legend== null) ? 0 : this.legend.hashCode()); + result = prime * result + ((this.range== null) ? 0 : this.range.hashCode()); + result = prime * result + ((this.full== null) ? 0 : this.full.hashCode()); + return prime * result + ((this.documentSelector== null) ? 0 : this.documentSelector.hashCode()); + } +} 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 160cd9136..f51d94c90 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 @@ -23,6 +23,7 @@ import org.eclipse.lsp4j.FoldingRangeProviderOptions; import org.eclipse.lsp4j.RenameOptions; import org.eclipse.lsp4j.SemanticHighlightingServerCapabilities; +import org.eclipse.lsp4j.SemanticTokensWithRegistrationOptions; import org.eclipse.lsp4j.SignatureHelpOptions; import org.eclipse.lsp4j.StaticRegistrationOptions; import org.eclipse.lsp4j.TextDocumentSyncKind; @@ -194,6 +195,14 @@ public class ServerCapabilities { */ private Either selectionRangeProvider; + /** + * The server provides semantic tokens support. + * + * Since 3.16.0 + */ + @Beta + private SemanticTokensWithRegistrationOptions semanticTokensProvider; + /** * Experimental server capabilities. */ @@ -823,6 +832,25 @@ public void setSelectionRangeProvider(final StaticRegistrationOptions selectionR this.selectionRangeProvider = Either.forRight(selectionRangeProvider); } + /** + * The server provides semantic tokens support. + * + * Since 3.16.0 + */ + @Pure + public SemanticTokensWithRegistrationOptions getSemanticTokensProvider() { + return this.semanticTokensProvider; + } + + /** + * The server provides semantic tokens support. + * + * Since 3.16.0 + */ + public void setSemanticTokensProvider(final SemanticTokensWithRegistrationOptions semanticTokensProvider) { + this.semanticTokensProvider = semanticTokensProvider; + } + /** * Experimental server capabilities. */ @@ -869,6 +897,7 @@ public String toString() { b.add("typeHierarchyProvider", this.typeHierarchyProvider); b.add("callHierarchyProvider", this.callHierarchyProvider); b.add("selectionRangeProvider", this.selectionRangeProvider); + b.add("semanticTokensProvider", this.semanticTokensProvider); b.add("experimental", this.experimental); return b.toString(); } @@ -1018,6 +1047,11 @@ public boolean equals(final Object obj) { return false; } else if (!this.selectionRangeProvider.equals(other.selectionRangeProvider)) return false; + if (this.semanticTokensProvider == null) { + if (other.semanticTokensProvider != null) + return false; + } else if (!this.semanticTokensProvider.equals(other.semanticTokensProvider)) + return false; if (this.experimental == null) { if (other.experimental != null) return false; @@ -1058,6 +1092,7 @@ public int hashCode() { result = prime * result + ((this.typeHierarchyProvider== null) ? 0 : this.typeHierarchyProvider.hashCode()); result = prime * result + ((this.callHierarchyProvider== null) ? 0 : this.callHierarchyProvider.hashCode()); result = prime * result + ((this.selectionRangeProvider== null) ? 0 : this.selectionRangeProvider.hashCode()); + result = prime * result + ((this.semanticTokensProvider== null) ? 0 : this.semanticTokensProvider.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 95e9774d9..af5802713 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 @@ -33,6 +33,7 @@ import org.eclipse.lsp4j.RenameCapabilities; import org.eclipse.lsp4j.SelectionRangeCapabilities; import org.eclipse.lsp4j.SemanticHighlightingCapabilities; +import org.eclipse.lsp4j.SemanticTokensCapabilities; import org.eclipse.lsp4j.SignatureHelpCapabilities; import org.eclipse.lsp4j.SynchronizationCapabilities; import org.eclipse.lsp4j.TypeDefinitionCapabilities; @@ -185,6 +186,14 @@ public class TextDocumentClientCapabilities { */ private SelectionRangeCapabilities selectionRange; + /** + * Capabilities specific to {@code textDocument/semanticTokens}. + * + * @since 3.16.0 + */ + @Beta + private SemanticTokensCapabilities semanticTokens; + @Pure public SynchronizationCapabilities getSynchronization() { return this.synchronization; @@ -584,6 +593,25 @@ public void setSelectionRange(final SelectionRangeCapabilities selectionRange) { this.selectionRange = selectionRange; } + /** + * Capabilities specific to {@code textDocument/semanticTokens}. + * + * @since 3.16.0 + */ + @Pure + public SemanticTokensCapabilities getSemanticTokens() { + return this.semanticTokens; + } + + /** + * Capabilities specific to {@code textDocument/semanticTokens}. + * + * @since 3.16.0 + */ + public void setSemanticTokens(final SemanticTokensCapabilities semanticTokens) { + this.semanticTokens = semanticTokens; + } + @Override @Pure public String toString() { @@ -613,6 +641,7 @@ public String toString() { b.add("typeHierarchyCapabilities", this.typeHierarchyCapabilities); b.add("callHierarchy", this.callHierarchy); b.add("selectionRange", this.selectionRange); + b.add("semanticTokens", this.semanticTokens); return b.toString(); } @@ -751,6 +780,11 @@ public boolean equals(final Object obj) { return false; } else if (!this.selectionRange.equals(other.selectionRange)) return false; + if (this.semanticTokens == null) { + if (other.semanticTokens != null) + return false; + } else if (!this.semanticTokens.equals(other.semanticTokens)) + return false; return true; } @@ -783,6 +817,7 @@ public int hashCode() { result = prime * result + ((this.semanticHighlightingCapabilities== null) ? 0 : this.semanticHighlightingCapabilities.hashCode()); result = prime * result + ((this.typeHierarchyCapabilities== null) ? 0 : this.typeHierarchyCapabilities.hashCode()); result = prime * result + ((this.callHierarchy== null) ? 0 : this.callHierarchy.hashCode()); - return prime * result + ((this.selectionRange== null) ? 0 : this.selectionRange.hashCode()); + result = prime * result + ((this.selectionRange== null) ? 0 : this.selectionRange.hashCode()); + return prime * result + ((this.semanticTokens== null) ? 0 : this.semanticTokens.hashCode()); } }