Skip to content
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

toString Generator shows fields in wrong order #2502

Closed
quochuyhl99 opened this issue Jun 10, 2022 · 2 comments · Fixed by eclipse-jdtls/eclipse.jdt.ls#2212
Closed

toString Generator shows fields in wrong order #2502

quochuyhl99 opened this issue Jun 10, 2022 · 2 comments · Fixed by eclipse-jdtls/eclipse.jdt.ls#2212

Comments

@quochuyhl99
Copy link

quochuyhl99 commented Jun 10, 2022

Environment
  • Operating System: Windows 10
  • JDK version: 17
  • Visual Studio Code version: 1.68.0
  • Java extension version: 0.23.0
Description

toString Generator shows fields in the wrong order leading to code generated in the wrong order too.

Untitled

Expected result:

Fields should show in correct order like the constructor.

Untitled1

@jdneo
Copy link
Collaborator

jdneo commented Jun 10, 2022

@CsCherrYY Looks like another code action ux related issue. Guess you might be interested in this. :)

@CsCherrYY
Copy link
Contributor

we now get the candidate list via ITypeBinding.getDeclaredFields(): https://github.com/eclipse/eclipse.jdt.ls/blob/726ece1d1fd26480028c217f1d27193f4cd05760/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/JdtDomModels.java#L60

The return array seems to not be in particular order. Maybe IType.getFields() returns the correct definition order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants