-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Typescript auto-import put comma in wrong position #40219
Comments
This is can be reproduced when new imported is last thing in that line, when '} from 'foo' is on newline, and having a trailing comma. It looks like auto-import didn't consider trailing comma: import {
foo1
} from 'foo'
// ==>
import {
foo1, foo2
} from 'foo' without trailing comma, auto-import does thing exactly correct, however, with trailing comma, it will wrong format |
Duplicated/related to #39717? |
Yes, it looks duplicate, I think because I searched for open issues, and that issue was closed, so I missed that. And previous closed because can't reproduce, I find a way to reproduce |
well, I can conform ts 4.1.0-dev.20200824, vs code 1.48.2 still has this issue |
I reproduced it with 11 imports: import {
Foo1, Foo2,
Foo3,
Foo4,
Foo5,
Foo6,
Foo7,
Foo8,
Foo9,
Foo10,, Foo11
} from './foo'
export default {
foo1: 1 as Foo1,
foo2: 2 as Foo2,
foo11: 11 as Foo11,
} |
Ok, that one repros for me. Thanks @chengB12 |
TypeScript Version: 4.1.0-dev.20200823
Visual Studio Code Version: 1.48.1
Search Terms: import comma
Code
Expected behavior:
When prompted Quick Fix => click "Add 'Foo6' to existing import declaration 'foo', and click auto-import
The import declaration shall be
Actual behavior:
The text was updated successfully, but these errors were encountered: