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

Code Actions are not sorted by relevance #1250

Closed
Eskibear opened this issue Nov 7, 2019 · 1 comment · Fixed by #1273
Closed

Code Actions are not sorted by relevance #1250

Eskibear opened this issue Nov 7, 2019 · 1 comment · Fixed by #1273

Comments

@Eskibear
Copy link
Contributor

Eskibear commented Nov 7, 2019

Currently, different kinds of proposals are sorted by ChangeCorrectionProposalComparator all together before converted to code actions. For proposals of different CodeActionKind, they are not sorted by relevance at all.

See https:/eclipse/eclipse.jdt.ls/blob/1dfdeeafb9d0dd7c16d915763a30088dfa3a721e/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/CodeActionHandler.java#L204-L223

Do we need to sort by relevance first?

@Eskibear
Copy link
Contributor Author

If the actions should be grouped by CodeActionKind, 'quickfix' should be on top of the list if there's a problem. The current comparator compare CodeActionKind first, in alphabetical order. The order happened to be "quickfix", "refactor", "source". But now we have new kind "quickassist", which would be ahead of "quickfix" in alphabetical order.

So I'd like to use a more robust way:

  • First sort actions by relevance for each CodeActionKind.
  • Then combine the actions of different kinds.

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.

2 participants