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

Unclear what Organize Imports does #158939

Closed
joyceerhl opened this issue Aug 23, 2022 · 1 comment
Closed

Unclear what Organize Imports does #158939

joyceerhl opened this issue Aug 23, 2022 · 1 comment
Assignees
Labels
*as-designed Described behavior is as designed

Comments

@joyceerhl
Copy link
Contributor

Testing #158636

I understand what Sort Imports does, but it's less clear to me what Organize Imports does--if I use Sort Imports and then Organize Imports they both end up doing something different to the imports in the file. Could we have the tooltips for these indicate what they are supposed to do?

Additionally it seems like the entries in the Source Actions dropdown are not contextually disabled, like the entries in the Refactor dropdown (e.g. if in a file that contains no imports, the actions for imports still show up).

@mjbvz
Copy link
Collaborator

mjbvz commented Aug 23, 2022

This has been the name for a long time. Organize is intentionally generic as it's meant to be something you run without really thinking. It magically cleans up your imports (by sorting them and removing unused imports). Sort was added after organize as a way to just sort without removing unused

It's always enabled because it's like format. We still let users run format even if the code is already formatted. If we disabled when the imports were already sorted, using a keybinding for organize imports would show error messages

@mjbvz mjbvz closed this as completed Aug 23, 2022
@mjbvz mjbvz added the *as-designed Described behavior is as designed label Aug 23, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Oct 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*as-designed Described behavior is as designed
Projects
None yet
Development

No branches or pull requests

3 participants