-
Notifications
You must be signed in to change notification settings - Fork 155
Add read/write access tags to call hierarchy and find references (fix #951) #954
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
travkin79
wants to merge
1
commit into
eclipse-lsp4j:main
Choose a base branch
from
travkin79:read-write-tags
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+136
−0
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
org.eclipse.lsp4j/src/main/java/org/eclipse/lsp4j/ReferenceTag.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| /****************************************************************************** | ||
| * Copyright (c) 2026 Advantest Europe GmbH and others. | ||
| * | ||
| * This program and the accompanying materials are made available under the | ||
| * terms of the Eclipse Public License v. 2.0 which is available at | ||
| * http://www.eclipse.org/legal/epl-2.0, | ||
| * or the Eclipse Distribution License v. 1.0 which is available at | ||
| * http://www.eclipse.org/org/documents/edl-v10.php. | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause | ||
| ******************************************************************************/ | ||
|
|
||
| package org.eclipse.lsp4j; | ||
|
|
||
| import org.eclipse.lsp4j.jsonrpc.ProtocolDraft; | ||
|
|
||
|
|
||
| /** | ||
| * <p>Reference tags represent additional details in CallHierarchyItems and References to adapt their rendering.</p> | ||
| * | ||
| * <p>This is an LSP <b>proposal</b>. See <a href="https://github.com/microsoft/language-server-protocol/pull/2226">PR</a></p> | ||
| */ | ||
| @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]; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @jonahgraham,
I'm still not sure how we should handle the new return type alternatives from the proposed LSP change. We could, of course, change the return type in
references(ReferenceParams)instead of introducing a new methodreferencesWithTags(ReferenceParams)and increase LSP4J's version according to semantic versioning, but since the proposed LSP change is not yet accepted, I'm not feeling comfortable with introducing a breaking change that we might have to roll back if the LSP proposal gets rejected.How do you think about introducing this additional method instead? It would avoid introducing a breaking change and even if the LSP proposal would be rejected some day, LSP4J wouldn't have to change the original method signature in
references(ReferenceParams).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we agree that LSP4J is the reference implementation (in a similar way microsoft/language-server-protocol#2003 is for symbol tags) then the "correct" version should be implemented here.
Which means making the API breaking change which is explicitly allowed in the API policy of the project https://github.com/eclipse-lsp4j/lsp4j?tab=readme-ov-file#new-versions-of-lsp-and-dap-specifications
IMHO it is cleaner to change the API than to start coding in workarounds.
If the change is reverted, we bump the version number again.