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

Add the "Sort Imports" back to the context menu options as "Organize Imports" #343

Open
ghost opened this issue Oct 29, 2023 · 12 comments
Open
Labels
feature-request Request for new features or functionality needs PR

Comments

@ghost
Copy link

ghost commented Oct 29, 2023

Regarding microsoft/vscode-python#22058, I don't understand the justification for this change. It was removed without adequate replacement.

I am aware of Organize Imports through the command Shift+Alt+o but why was it not added to the right-click context-menu?

In response to microsoft/vscode-python#20233, it is not redundant. Using Code Actions via Ctrl+. or Source Action... from the right-click context menu does not always provide actions for unsorted imports. I fresh installed vs-code and Python with appropriate extensions, opened one of my Python scripts and unsorted the imports, and attempting to use the above no options were provided to sort imports aside from the command for Organize Imports.

Perhaps I'm being pedantic but I like having the option to sort imports via context-menu when reading many files with many lines of code. Two mouse-clicks versus taking my hand off the mouse to press three keys. Fewer actions are better.

I think this change should be reverted such that "Sort Imports" becomes "Organize Imports".

😊 Added smiley face to take off the edge of this lemony request

@ghost ghost added the feature-request Request for new features or functionality label Oct 29, 2023
@github-actions github-actions bot added the triage-needed Issue is not triaged. label Oct 29, 2023
@ghost ghost changed the title Add the "Sort Imports" back to the menu options as "Organize Imports" Add the "Sort Imports" back to the context menu options as "Organize Imports" Oct 29, 2023
@karthiknadig karthiknadig removed feature-request Request for new features or functionality triage-needed Issue is not triaged. labels Oct 30, 2023
@karthiknadig karthiknadig transferred this issue from microsoft/vscode-python Oct 30, 2023
@github-actions github-actions bot added the triage-needed Issue is not triaged. label Oct 30, 2023
@karthiknadig karthiknadig added feature-request Request for new features or functionality needs community feedback and removed triage-needed Issue is not triaged. labels Oct 30, 2023
@karthiknadig
Copy link
Member

Thanks for the feature request! We are going to give the community 60 days from when this issue was created to provide 7 👍 upvotes on the opening comment to gauge general interest in this idea. If there's enough upvotes then we will consider this feature request in our future planning. If there's unfortunately not enough upvotes then we will close this issue.

@israel-oye
Copy link

We have 8 votes now.

@coreybrett
Copy link

This is driving me nuts too

@karthiknadig
Copy link
Member

I want to better understand the use case here, in settings you can add:

"[python]": {
        "editor.codeActionsOnSave": {
            "source.organizeImports.isort": "explicit"
        }
    },

This will trigger this automatically on save. Is that not enough?

@israel-oye
Copy link

Imo, it's not enough. It is bad UX
Let the user have a control over the settings. If there's a way to set it explicitly, there should be a way to do it implicitly as well. Just my two cents.
[Hashtag]BringBackOurBelovedMenuOption ✋🏾

@ghost
Copy link
Author

ghost commented Nov 19, 2023

I want to better understand the use case here, in settings you can add:

"[python]": {
        "editor.codeActionsOnSave": {
            "source.organizeImports.isort": "explicit"
        }
    },

This will trigger this automatically on save. Is that not enough?

@karthiknadig, the feature request is to revert the following commit that removed a feature and to rename it Organize Imports:

Also, I must be taking crazy pills if what I wrote is unclear.

  • An MS developer suggested the removal of a feature and deemed it redundant without justification or replacement.
  • Others and I noticed the removal of said feature and want it reverted.
  • I opened an issue to address this absurdly random code change.

Use Case:

  • I'm not sure why I have to provide a Use Case to revert a code change.
  • Brings back a feature that had no reason to be removed.
  • Enables Python developers using VS-Code to sort imports using the context menu item "Organize Imports" which before was called "Sort Imports". None of the other options are as effective in sorting imports.

@brettcannon
Copy link
Member

  • An MS developer suggested the removal of a feature and deemed it redundant without justification or replacement.

There was justification, but it was in a meeting about this specific menu item with the wider VS Code team. This decision was not done flippantly or lightly.

  • I opened an issue to address this absurdly random code change.

Please keep the tone cordial or I will lock this issue. It is not absurd and it was not random. You are welcome to disagree with the decision, but rudeness is not okay.

  • I'm not sure why I have to provide a Use Case to revert a code change.

The reason we ask for a use case is we have our reasons for removing and any amount of code has a maintenance cost. As such, we are willing to at least discuss this with you, but it is not a "free" thing to bring the feature back. And honestly, this extension is already a bit "expensive" to maintain due to isort itself not being actively maintained, leading us to work around some bugs with isort.

Also note that if you strongly disagree with us not having the menu item, you can always fork this extension to add it back or create your own extension that just adds the menu item and triggers this extension behind the scenes.

@ghost
Copy link
Author

ghost commented Nov 23, 2023

@brettcannon

Thanks for the clarification. The context behind the decision is appreciated.

I have a herd of lemons I'm keeping at bay and one got loose. More dangerous than lemmings!

Given this newfound insight I ask, is a general code sorting solution in development to serve as replacement?

@brettcannon
Copy link
Member

Not at the moment. We are talking about it within the team, but no decision has been reached. We got explicitly asked by the wider VS Code team to nest related commands to cut down on vertical real estate in right-click menus, so bringing it back might be a hard sell.

@lcmartinezdev
Copy link

I miss a lot the context menu options as well. Please add it again.

@ohaucke
Copy link

ohaucke commented Feb 29, 2024

And here i am, wondering where the "sort" option was hiding.
CTRL + . results in a No organize imports action available
SHIFT + ALT + o is new to me and a bit cumbersome to remember for someone who only uses python once per quarter
CRTL + SHIFT + P and searching for Organize Imports is counter intuitive: i wanna sort them, so i'm searching for sort ...

@brettcannon
Copy link
Member

@ohaucke I edited your ✉️ ⬆️ to come off as more 😃 and less 😠, else it would likely would have ended up being hidden.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality needs PR
Projects
None yet
Development

No branches or pull requests

7 participants