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

Sorting/ranking of code actions #33756

Closed
Tyriar opened this issue Sep 3, 2017 · 5 comments
Closed

Sorting/ranking of code actions #33756

Tyriar opened this issue Sep 3, 2017 · 5 comments
Assignees
Labels
api *duplicate Issue identified as a duplicate of another issue(s) editor-code-actions Editor inplace actions (Ctrl + .) under-discussion Issue is under discussion for relevance, priority, approach

Comments

@Tyriar
Copy link
Member

Tyriar commented Sep 3, 2017

If available, it will probably be the most useful.

screen shot 2017-09-03 at 10 18 39 am

@Tyriar Tyriar added the typescript Typescript support issues label Sep 3, 2017
@mjbvz
Copy link
Collaborator

mjbvz commented Sep 4, 2017

@jrieken Adding you since I believe this would require an API change to code actions to add a sort order or similar

@mjbvz mjbvz added editor-code-actions Editor inplace actions (Ctrl + .) javascript JavaScript support issues labels Sep 4, 2017
@jrieken
Copy link
Member

jrieken commented Sep 5, 2017

add a sort order or similar

And how do you do that given there is multiple providers that only have a local view of the world? I am open for ideas but it is tricky. From the tslint's POV inserting the missing semicolon is key, from typescript's POV inserting the import is key.

@jrieken jrieken added api and removed javascript JavaScript support issues typescript Typescript support issues labels Sep 5, 2017
@jrieken jrieken changed the title TypeScript import code action should be at the top Sorting/ranking of code actions Sep 5, 2017
@jrieken jrieken added the under-discussion Issue is under discussion for relevance, priority, approach label Sep 5, 2017
@mjbvz
Copy link
Collaborator

mjbvz commented Sep 5, 2017

I'm not sure we can create a general solution. A few ideas on how some sort of ordering could be introduced though:

  • Sort of error severity.

    If code actions had additional metadata about which error they fixed, sort so that fixes for errors are shown before fixes for warnings. We could also use the error info to group fixes by error, or use this info to show error information like VS does in its quick fix menu

  • Sort by fixed error range.

    One idea would be to show actions that fix errors that span larger ranges. Not sure if this would be useful

  • Create types of quick fixes, similar to intellij. Show quick fixes before other actions like refactorings

  • Show actions that fix the problem higher than actions that suppress the problem. This also would require some additional metadata on the code action, similar to quick fix types.

@jrieken
Copy link
Member

jrieken commented Sep 6, 2017

Yes, it all requires enhanced API, I like the code-action-diagnostics-association, tho things need to be thought out carefully as there are also other requests in this area, like expressing a code action as text edit(s) and not just as command

@jrieken
Copy link
Member

jrieken commented Dec 11, 2017

Closing this as a dupe of #38623 and #34664 which makes code actions know the errors they fix. We will use that as sorting/grouping hint

@jrieken jrieken closed this as completed Dec 11, 2017
@jrieken jrieken added the *duplicate Issue identified as a duplicate of another issue(s) label Dec 11, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api *duplicate Issue identified as a duplicate of another issue(s) editor-code-actions Editor inplace actions (Ctrl + .) under-discussion Issue is under discussion for relevance, priority, approach
Projects
None yet
Development

No branches or pull requests

3 participants