Skip to content

Adding an import with quick fix should respect sort order #16119

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

Closed
JoshuaKGoldberg opened this issue May 27, 2017 · 1 comment
Closed

Adding an import with quick fix should respect sort order #16119

JoshuaKGoldberg opened this issue May 27, 2017 · 1 comment
Labels
Bug A bug in TypeScript Domain: Quick Fixes Editor-provided fixes, often called code actions.
Milestone

Comments

@JoshuaKGoldberg
Copy link
Contributor

JoshuaKGoldberg commented May 27, 2017

TypeScript Version: 2.3

Code

Before the suggested B import is added:

import { A, C } from "./letters";

const b: B = new B(); // suggestion to import B from "./letters";

After:

import { A, C, B } from "./letters"; // TSLint's ordered-import rule is now offering a quick fix

const b: B = new B();

Expected behavior:

If the imports are sorted, adding a new one should add in sorted order. In this case it would be { A, B, C }.

Actual behavior:

The added import is tacked onto the end.

If the preference for keeping imports sorted will be added in #10020, it seems like it would make sense to respect that order in individual adds as well.

@mhegazy mhegazy added the Bug A bug in TypeScript label May 30, 2017
@mhegazy mhegazy added this to the TypeScript 2.4 milestone May 30, 2017
@mhegazy mhegazy added the Domain: Quick Fixes Editor-provided fixes, often called code actions. label May 30, 2017
@mhegazy mhegazy modified the milestones: TypeScript 2.4, TypeScript 2.5 Jun 5, 2017
@amcasey amcasey assigned amcasey and unassigned aozgaa and amcasey Aug 21, 2017
@mhegazy mhegazy modified the milestones: TypeScript 2.6, Future Aug 31, 2017
@amcasey amcasey removed their assignment Dec 6, 2019
@JoshuaKGoldberg
Copy link
Contributor Author

IME this has since been resolved. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: Quick Fixes Editor-provided fixes, often called code actions.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants