-
Notifications
You must be signed in to change notification settings - Fork 436
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
Inlay hints wrong order for records #2414
Comments
I think this is caused by the /**
* Returns a list of bindings representing all the fields declared
* as members of this class, interface, or enum type.
*
* <p>These include public, protected, default (package-private) access,
* and private fields declared by the class, but excludes inherited fields.
* Synthetic fields may or may not be included. Fields from binary types that
* reference unresolved types may not be included.</p>
*
* <p>Returns an empty list if the class, interface, or enum declares no fields,
* and for other kinds of type bindings that do not directly have members.</p>
*
* <p>The resulting bindings are in no particular order.</p>
*
* @return the list of bindings for the field members of this type,
* or the empty list if this type does not have field members
*/
public IVariableBinding[] getDeclaredFields(); |
Hi @angelozerr, Do you have any idea how we can support inlay hints for |
No sorry I cannot help you for this topic. |
It doesn't look like there's currently a way to access it :\ , although it looks possible to add the API to MethodDeclaration (IMethodDeclaration). The only other way I can see to do this is by getting access to the compilation unit where the record is declared, and go to the |
Yes, that means we need first find the record type in the Java project, and then get its type root, which would be too expensive for displaying inlay hints. How about we try to add the API at upstream? Before the new API is available, we disable the inlay hint for record method invocations temporarily. |
@rgrunber Will you add that required API at upstream? |
JDT Core : eclipse-jdt/eclipse.jdt.core@master...rgrunber:param-names-api The JDT Core change is all that's needed to expose the necessary API. We can probably write the same code as in JDT UI. I'll go ahead and propose these changes. |
The API to do this on JDT Core has been available since https://download.eclipse.org/eclipse/updates/4.25-I-builds/I20220719-1800/ . I've also merged a change to fix the issue on Eclipse, so we should be able to go ahead and fix it in JDT-LS now. See https:/eclipse-jdt/eclipse.jdt.ui/pull/149/files for an example. |
Thank you @rgrunber, I'll follow up the fix at the JDT.LS side. |
Hello, when using the new inlay hints I just discovered that sometimes the order of the arguments was not correct.
Example:
For the moment it only happened to me when using java records syntax.
Environment
The text was updated successfully, but these errors were encountered: