-
Notifications
You must be signed in to change notification settings - Fork 12.8k
source.organizeImports affects export object #61588
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
Comments
Confirmed. No setting change required here, just need to invoke the "Organize Imports" command from the palette. |
@RyanCavanaugh I noticed the behavior seems tied to the default settings for That said, the issue has a |
Initially when I looked at this, I thought that the problem is that the detection code isn't working (which applies when the user hasn't set anything explicitly), however rereading this, the two different blocks have two different sortings. The imports are not sorted naturally, but the exports are sorted naturally. So no matter what we're doing, we're going to resort one of the blocks. I can't say I like the edit that was chosen here, but, is there anything actually wrong here outside the suboptimal columns? |
I am uncertain whether @jakebailey 's question was directed at me, but I would like to offer my two cents on this regardless. Choosing sample 1 through 13 for my example was not ideal, I agree. However, I am not taking issue in the order of the keys, but with the way they are put on the same line in some instances. I would like to add, that this only happens once a certain number of keys has been reached. Through the issue mentioned by @idango10 I learned that the To me it would be sufficient if keys remained in a one-per-line configuration, as this is important for readability in this scenario. Would renaming the settings or splitting import and export sorting be plausible to avoid confusion and/or conflicts with other import/export sorting? |
Does this issue occur when all extensions are disabled?: Yes/No
Yes
Steps to Reproduce:
With
"source.OrganizeImports" = "explicit"
exports of a TypeScript file are also affected.I set up an example that looks like this:
When I add a newline and save the file it results in this:
I expect the order of the exports to be untouched.
We are using an EsLint Plugin to sort the exports alphabetically (which is not happy with the result of the import organization), but the issue stems from the setting. Launching VS Code without any extension produces the same result.
The example can be found here: https://github.com/Zitrooone/vscode-organizeImports-test
The text was updated successfully, but these errors were encountered: