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 adds extra comma to import statements with trailing commas #40561
Comments
(Experimental duplicate detection) |
Self contained example:
export const a = 123;
export const b = 123;
export const c = 123;
import {
b,
a,
} from './x'
console.log(c) // trigger import here |
@andrewbranch does #40303 fix this for the 4.0 branch? |
Yes |
Well, I’m confused as to how this was happening on the nightly for the 11th. I’ll investigate, but this seems to be the exact same issue. |
Yeah, I can't reproduce this with the nightly mentioned or with current master. @mjbvz was your repro using a nightly TS build? |
@andrewbranch Actually this looks fixed in nightly; I must have tested it incorrectly. Can we make sure this fix is included in the next 4.0 recovery? |
I have the same issue. |
It will be in the next patch release, 4.0.3. |
I am still facing this issue too, how can I fix it in my VS Code? -> microsoft/vscode#107057 |
I still have this problem :( I installed globally the newest typescript (4.1.3) and set |
@mlewando does the TS version in the bottom-right match what you set? If so, please post exact steps for how to reproduce. |
Hi @andrewbranch I have a JavaScript project. I think that VS Code uses typescript under the hood anyway to autocomplete imports, but I don't have typescript version in my status bar: the exact steps to reproduce for not is rather "it happens from time to time", but if it is (or may be) related, I will try to identify the exact reproduction. |
Thanks! The text of all your imports before and after the auto import should be enough to reproduce. |
So, I created a simple reproduction without a problem, and then I tried to reproduce it on the simple example with all extensions disabled - I failed. So I started to disable extensions until I identified the problematic one: exports autocomplete (https://github.com/capaj/vscode-exports-autocomplete) To sum up: for me, problem is solved :) thank you for attention :) |
TS Template added by @mjbvz
TypeScript Version: 4.0.2
Search Terms
Steps to Reproduce:
Eg:
Results:
The new file is added to the import statement with an extra comma:
Expected Results:
The import should be added on a new line with trailing comma:
The proper behavior occurs in version 1.48.2
Does this issue occur when all extensions are disabled?: Yes
The text was updated successfully, but these errors were encountered: