Skip to content

Support isPreferred from CodeAction #829

Open
@BoykoAlex

Description

@BoykoAlex

I only have in mind showing a quickfix (marker resolution) created based on CodeAction marked as "preferred" above other quickfixes.

Eclipse sorts quick fixes alphabetically which may not be desirable... For example there are 3 quick fixes proposed to a problem:

  1. Fix the problem in the current code snippet
  2. Fix all such problems in the current java file
  3. Fix all such problems in the corresponding java project

The preferred fix would the current code snippet but it is challenging to push it at the top of the list due to Eclipse's alphabetical sorting. Either label becomes ugly and inconsistent or the order is reversed.

Currently Eclipse sorts the list of quick fixes (together with assists and refactorings) in alphabetical order with org.eclipse.jdt.ui.text.java.CompletionProposalComparator.CompletionProposalComparator. It is not meant to sort alphabetically since the fOrderAlphabetically is false but it falls through to alphabetical order based on resolution labels due to the type of marker resolution object type, i.e. no "relevance" property. The "relevance" property is only available in IJavaCompletionProposal subtypes. However, org.eclipse.lsp4e.operations.codeactions.CodeActionMarkerResolution cannot implement IJavaCompletionProposal because it should be independent from JDT.

What would be your thoughts on this @mickaelistria @rubenporras @angelozerr ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions