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 5f0d343a..aafab966 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 @@ -40,6 +40,7 @@ import org.eclipse.lsp4j.jsonrpc.validation.NonNull import org.eclipse.lsp4j.jsonrpc.ProtocolDeprecated import org.eclipse.lsp4j.jsonrpc.ProtocolDraft import org.eclipse.lsp4j.jsonrpc.ProtocolSince +import java.util.Collections @JsonRpcData class DynamicRegistrationCapabilities { @@ -848,6 +849,17 @@ class SignatureHelpCapabilities extends DynamicRegistrationCapabilities { */ @JsonRpcData class ReferencesCapabilities extends DynamicRegistrationCapabilities { + + /** + *
Determines whether the client supports and prefers {@link Reference} items instead + * of {@link Location} items. If this value is missing, the server assumes that the + * client accepts Location items as defined in earlier versions of the protocol.
+ * + *This is an LSP proposal. See PR
+ */ + @ProtocolDraft + Boolean referenceItemsSupport; + new() { } @@ -1695,6 +1707,16 @@ class TypeHierarchyRegistrationOptions extends AbstractTextDocumentRegistrationA @ProtocolSince("3.16.0") @JsonRpcData class CallHierarchyCapabilities extends DynamicRegistrationCapabilities { + + /** + *Determines whether the client supports reference tags. If the value is missing, + * the server assumes that the client does not support reference tags.
+ * + *This is an LSP proposal. See PR
+ */ + @ProtocolDraft + Boolean referenceTagsSupport; + new() { } @@ -5287,6 +5309,42 @@ class Location { } } +/** + *Represents a reference to a symbol and describes the kind of reference, e.g. read or write access, + * in addition to its location in a resource.
+ * + *This is an LSP proposal. See PR
+ */ +@ProtocolDraft +@JsonRpcData +class Reference { + @NonNull + Location location + + @NonNull + ListReference tags for this item.
+ * + *This is an LSP proposal. See PR
+ */ + @ProtocolDraft + ListReference tags represent additional details in CallHierarchyItems and References to adapt their rendering.
+ * + *This is an LSP proposal. See PR
+ */ +@ProtocolDraft +public enum ReferenceTag { + + /** + * Render a CallHierarchyItem or Reference as read access, e.g. in a call hierarchy. + */ + Read(1), + + /** + * Render a CallHierarchyItem or Reference as write access, e.g. in a call hierarchy. + */ + Write(2); + + + private final int value; + + ReferenceTag(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + + public static ReferenceTag forValue(int value) { + ReferenceTag[] allValues = ReferenceTag.values(); + if (value < 1 || value > allValues.length) + throw new IllegalArgumentException("Illegal enum value: " + value); + return allValues[value - 1]; + } +} \ No newline at end of file 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 0cacc9f7..39422081 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 @@ -73,6 +73,7 @@ import org.eclipse.lsp4j.PrepareRenameParams; import org.eclipse.lsp4j.PrepareRenameResult; import org.eclipse.lsp4j.Range; +import org.eclipse.lsp4j.Reference; import org.eclipse.lsp4j.ReferenceParams; import org.eclipse.lsp4j.RenameParams; import org.eclipse.lsp4j.SelectionRange; @@ -220,6 +221,22 @@ default CompletableFutureThe references request is sent from the client to the server to resolve + * project-wide references for the symbol denoted by the given text document + * position.
+ * + * Registration Options: {@link org.eclipse.lsp4j.ReferenceRegistrationOptions} + * + *This is an LSP proposal. See PR + * This method is planned to replace {@link #references(ReferenceParams)} and could be renamed to 'references' in future.
+ */ + // TODO introduce this new method (avoid a breaking change) or replace #references(ReferenceParams)? + @JsonRequest + default CompletableFuture