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

auto-import inserts new import before first comment #39922

Closed
jessetrinity opened this issue Aug 5, 2020 · 0 comments · Fixed by #39924
Closed

auto-import inserts new import before first comment #39922

jessetrinity opened this issue Aug 5, 2020 · 0 comments · Fixed by #39924
Assignees
Labels
Bug A bug in TypeScript Domain: Auto-import Fix Available A PR has been opened for this issue

Comments

@jessetrinity
Copy link
Contributor

Discovered in VS integration tests

TypeScript Version: 4.1.0-dev.20200804

Search Terms:
header, import

For the purposes of organize imports, we do not move the first comment as we assume that it is a copyright header. Auto imports now inserts imports alphabetically with the first comment remaining attached to the first import, so a new import can come before our "copyright header".

Code

/* Copyright */

import { bar } from "./src/b";

bar;

Expected behavior:

/* Copyright */

import { foo } from "./src/a";
import { bar } from "./src/b";

bar;
foo

Actual behavior:

import { foo } from "./src/a";
/* Copyright */

import { bar } from "./src/b";

bar;
foo
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: Auto-import Fix Available A PR has been opened for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants