Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.eclipse.lsp4j.debug.StoppedEventArguments;
import org.eclipse.lsp4j.debug.TerminatedEventArguments;
import org.eclipse.lsp4j.debug.ThreadEventArguments;
import org.eclipse.lsp4j.jsonrpc.ProtocolSince;
import org.eclipse.lsp4j.jsonrpc.services.JsonNotification;
import org.eclipse.lsp4j.jsonrpc.services.JsonRequest;

Expand Down Expand Up @@ -249,9 +250,8 @@ default void invalidated(InvalidatedEventArguments args) {
* Debug adapters are not expected to emit this event for each and every memory change of
* a running program, because that information is typically not available from debuggers
* and it would flood clients with too many events.
* <p>
* Since 1.49
*/
@ProtocolSince("1.49")
@JsonNotification
default void memory(MemoryEventArguments args) {
}
Expand Down Expand Up @@ -293,9 +293,8 @@ default CompletableFuture<RunInTerminalResponse> runInTerminal(RunInTerminalRequ
* type as the caller) in the same way that the caller's session was started. If the client
* supports hierarchical debug sessions, the newly created session can be treated as a child
* of the caller session.
* </p>
* Since 1.59
*/
@ProtocolSince("1.59")
@JsonRequest
default CompletableFuture<Void> startDebugging(StartDebuggingRequestArguments args) {
throw new UnsupportedOperationException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
import org.eclipse.lsp4j.debug.VariablesResponse;
import org.eclipse.lsp4j.debug.WriteMemoryArguments;
import org.eclipse.lsp4j.debug.WriteMemoryResponse;
import org.eclipse.lsp4j.jsonrpc.ProtocolSince;
import org.eclipse.lsp4j.jsonrpc.services.JsonRequest;

/**
Expand Down Expand Up @@ -687,9 +688,8 @@ default CompletableFuture<ReadMemoryResponse> readMemory(ReadMemoryArguments arg
* <p>
* Clients should only call this request if the corresponding capability
* {@link Capabilities#getSupportsWriteMemoryRequest} is true.
* <p>
* Since 1.48
*/
@ProtocolSince("1.48")
@JsonRequest
default CompletableFuture<WriteMemoryResponse> writeMemory(WriteMemoryArguments args) {
throw new UnsupportedOperationException();
Expand All @@ -708,9 +708,8 @@ default CompletableFuture<DisassembleResponse> disassemble(DisassembleArguments

/**
* Looks up information about a location reference previously returned by the debug adapter.
* <p>
* Since 1.68
*/
@ProtocolSince("1.68")
@JsonRequest
default CompletableFuture<LocationsResponse> locations(LocationsArguments args) {
throw new UnsupportedOperationException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
package org.eclipse.lsp4j.generator

import com.google.gson.annotations.JsonAdapter
import org.eclipse.lsp4j.jsonrpc.ProtocolDeprecated
import org.eclipse.lsp4j.jsonrpc.ProtocolDraft
import org.eclipse.lsp4j.jsonrpc.ProtocolSince
import org.eclipse.lsp4j.jsonrpc.validation.NonNull
import org.eclipse.xtend.lib.annotations.AccessorsProcessor
import org.eclipse.xtend.lib.annotations.EqualsHashCodeProcessor
Expand Down Expand Up @@ -58,33 +61,48 @@ class JsonRpcDataProcessor extends AbstractClassProcessor {
!static
].forEach [ field |
val accessorsUtil = new AccessorsProcessor.Util(context)
val deprecated = field.findAnnotation(Deprecated.findTypeGlobally)
accessorsUtil.addGetter(field, Visibility.PUBLIC)
val protocolDraft = field.findAnnotation(ProtocolDraft.newTypeReference.type)
val protocolSince = field.findAnnotation(ProtocolSince.newTypeReference.type)
val protocolDeprecated = field.findAnnotation(ProtocolDeprecated.newTypeReference.type)
val deprecated = field.findAnnotation(Deprecated.newTypeReference.type)
val hasNonNull = field.findAnnotation(NonNull.newTypeReference.type) !== null
val hasJsonAdapter = field.findAnnotation(JsonAdapter.newTypeReference.type) !== null
accessorsUtil.addGetter(field, Visibility.PUBLIC)
impl.findDeclaredMethod(accessorsUtil.getGetterName(field)) => [
docComment = field.docComment
if (protocolDraft !== null)
addAnnotation(protocolDraft)
if (protocolSince !== null)
addAnnotation(protocolSince)
if (protocolDeprecated !== null)
addAnnotation(protocolDeprecated)
if (deprecated !== null)
addAnnotation(deprecated)
if (hasNonNull) {
addAnnotation(newAnnotationReference(NonNull))
}
if (deprecated !== null)
addAnnotation(newAnnotationReference(Deprecated))
]

if (!field.type.inferred) {
accessorsUtil.addSetter(field, Visibility.PUBLIC)
val setterName = accessorsUtil.getSetterName(field)
impl.findDeclaredMethod(setterName, field.type) => [
docComment = field.docComment
if (protocolDraft !== null)
addAnnotation(protocolDraft)
if (protocolSince !== null)
addAnnotation(protocolSince)
if (protocolDeprecated !== null)
addAnnotation(protocolDeprecated)
if (deprecated !== null)
addAnnotation(deprecated)
if (hasNonNull) {
val parameter = parameters.head
parameter.addAnnotation(newAnnotationReference(NonNull))
body = '''
this.«field.simpleName» = «getPreconditionsUtil(impl, context)».checkNotNull(«parameter.simpleName», "«field.simpleName»");
'''
}
if (deprecated !== null)
addAnnotation(newAnnotationReference(Deprecated))
]
val childTypes = field.type.childTypes
if (!childTypes.empty) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* Copyright (c) 2025 1C-Soft LLC.
*
* 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.jsonrpc;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Specifies the version of a Protocol Specification in which an API using this annotation
* was first introduced.
*/
@Retention(RetentionPolicy.CLASS)
@Target({
ElementType.CONSTRUCTOR,
ElementType.FIELD,
ElementType.METHOD,
ElementType.TYPE
})
@Documented
public @interface ProtocolSince {
/**
* Returns the version of a Protocol Specification in which the annotated element
* was first introduced. The version string is in the same format as the value of
* the {@code @since} tag.
*
* @return the version string
*/
String value();
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
******************************************************************************/
package org.eclipse.lsp4j.jsonrpc.messages;

import org.eclipse.lsp4j.jsonrpc.ProtocolSince;

/**
* A number indicating the error type that occurred.
*/
Expand Down Expand Up @@ -48,9 +50,8 @@ public enum ResponseErrorCode {
* be defined between the start and end range. For backwards
* compatibility the {@link #ServerNotInitialized} and the
* {@link #UnknownErrorCode} are left in the range.
* <p>
* Since 3.16.0
*/
@ProtocolSince("3.16.0")
jsonrpcReservedErrorRangeStart(-32099),

/**
Expand All @@ -64,36 +65,32 @@ public enum ResponseErrorCode {
/**
* This is the end range of JSON RPC reserved error codes.
* It doesn't denote a real error code.
* <p>
* Since 3.16.0
*/
@ProtocolSince("3.16.0")
jsonrpcReservedErrorRangeEnd(-32000),

/**
* This is the start range of LSP reserved error codes.
* It doesn't denote a real error code.
* <p>
* Since 3.16.0
*/
@ProtocolSince("3.16.0")
lspReservedErrorRangeStart(-32899),

/**
* A request failed but it was syntactically correct, e.g the
* method name was known and the parameters were valid. The error
* message should contain human readable information about why
* the request failed.
* <p>
* Since 3.17.0
*/
@ProtocolSince("3.17.0")
RequestFailed(-32803),

/**
* The server cancelled the request. This error code should
* only be used for requests that explicitly support being
* server cancellable.
* <p>
* Since 3.17.0
*/
@ProtocolSince("3.17.0")
ServerCancelled(-32802),

/**
Expand All @@ -117,9 +114,8 @@ public enum ResponseErrorCode {
/**
* This is the end range of LSP reserved error codes.
* It doesn't denote a real error code.
* <p>
* Since 3.16.0
*/
@ProtocolSince("3.16.0")
lspReservedErrorRangeEnd(-32800);

private final int value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
package org.eclipse.lsp4j;

import org.eclipse.lsp4j.jsonrpc.ProtocolDraft;
import org.eclipse.lsp4j.jsonrpc.ProtocolSince;

/**
* Defines how values from a set of defaults and an individual item will be merged.
* <p>
* Since 3.18.0
*/
@ProtocolDraft
@ProtocolSince("3.18.0")
public enum ApplyKind {
/**
* The value from the individual item (if provided and not {@code null}) will be
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
package org.eclipse.lsp4j;

import org.eclipse.lsp4j.jsonrpc.ProtocolDraft;
import org.eclipse.lsp4j.jsonrpc.ProtocolSince;

/**
* Code action tags are extra annotations that tweak the behavior of a code action.
* <p>
* Since 3.18.0
*/
@ProtocolDraft
@ProtocolSince("3.18.0")
public enum CodeActionTag {
/**
* Marks the code action as LLM-generated.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
******************************************************************************/
package org.eclipse.lsp4j;

import org.eclipse.lsp4j.jsonrpc.ProtocolSince;

/**
* The reason why code actions were requested.
* <p>
* Since 3.17.0
*/
@ProtocolSince("3.17.0")
public enum CodeActionTriggerKind {
/**
* Code actions were explicitly requested by the user or by an extension.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@

package org.eclipse.lsp4j;

import org.eclipse.lsp4j.jsonrpc.ProtocolSince;

/**
* Completion item tags are extra annotations that tweak the rendering of a completion
* item.
* <p>
* Since 3.15.0
*/
@ProtocolSince("3.15.0")
public enum CompletionItemTag {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
******************************************************************************/
package org.eclipse.lsp4j;

import org.eclipse.lsp4j.jsonrpc.ProtocolSince;

/**
* How a completion was triggered
*/
Expand All @@ -30,9 +32,8 @@ public enum CompletionTriggerKind {

/**
* Completion was re-triggered as the current completion list is incomplete.
* <p>
* Since 3.6.0
*/
@ProtocolSince("3.6.0")
TriggerForIncompleteCompletions(3);

private final int value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@

package org.eclipse.lsp4j;

import org.eclipse.lsp4j.jsonrpc.ProtocolSince;

/**
* The diagnostic tags.
* <p>
* Since 3.15.0
*/
@ProtocolSince("3.15.0")
public enum DiagnosticTag {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
******************************************************************************/
package org.eclipse.lsp4j;

import org.eclipse.lsp4j.jsonrpc.ProtocolSince;

/**
* Inlay hint kinds.
* <p>
* Since 3.17.0
*/
@ProtocolSince("3.17.0")
public enum InlayHintKind {
/**
* An inlay hint that for a type annotation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
package org.eclipse.lsp4j;

import org.eclipse.lsp4j.jsonrpc.ProtocolDraft;
import org.eclipse.lsp4j.jsonrpc.ProtocolSince;

/**
* Describes how an inline completion request was triggered.
* <p>
* Since 3.18.0
*/
@ProtocolDraft
@ProtocolSince("3.18.0")
public enum InlineCompletionTriggerKind {
/**
* Completion was triggered explicitly by a user gesture. Return multiple
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
******************************************************************************/
package org.eclipse.lsp4j;

import org.eclipse.lsp4j.jsonrpc.ProtocolSince;

/**
* How whitespace and indentation is handled during completion
* item insertion.
* <p>
* Since 3.16.0
*/
@ProtocolSince("3.16.0")
public enum InsertTextMode {

/**
Expand Down
Loading
Loading