-
Notifications
You must be signed in to change notification settings - Fork 12.8k
TypeScript Organize Imports inserts extra newline #36102
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
Should this be in 3.8? |
@DanielRosenwasser @elibarzilay Can I pick it up? |
Yes |
(Unless @elibarzilay has already started, but I assume you can go ahead) |
@DanielRosenwasser if @elibarzilay has already started then I will only follow this. Anyway I don't know where to start |
I believe you'll need to fix |
@Kinrany Thank you |
@DanielRosenwasser @elibarzilay @Kinrany
How should I do it right? |
@captain-yossarian I'm new so little experience with trying to run things live, instead I start with a test case for the problem and then use the debugger. |
Do you have any auto formatters installed currently? Something like prettier may be adding the new line. |
Organize Imports was inserting extra newline. Fixes microsoft#36102
Organize Imports was inserting extra newline. Fixes microsoft#36102
Organize Imports was inserting extra newline. Fixes microsoft#36102
Organize Imports was inserting extra newline. Fixes microsoft#36102
Organize Imports was inserting extra newline. Fixes #36102
If someone out there is still having this issue, try disabling the "EditorConfig for VS Code" extension or removing |
I did set |
@MM1132 This issue is about a problem where VS Code inserts two newlines at the end of imports, which can be solved by disabling insertFinalNewline. This solution will not make VS Code stop inserting a single newline at the end of imports, it just fixes the duplicate newline problem. |
@RudeySH |
I didn't test it extensively, but for me adding the following to "files.insertFinalNewline": true,
"files.trimFinalNewlines": true, With that, multiple newlines at the end of a file are being trimmed to only have a single newline, and it seems that this setting runs last. |
TS Template added by @mjbvz
TypeScript Version: 3.8.0-dev.20200108
Search Terms
In TypeScript / JavaScript, the command
Organize Imports
inserts up to two newlines ifexport { ... };
is at the end of a file. This does not happen with other forms ofexport
.Steps to Reproduce:
Organize Imports
command. It will insert a newline after theexport { ... };
Organize Imports
command again. It will insert another newline, resulting in two empty lines at the end of the file.Expected behavior
Only one newline is inserted / kept after the
export { ... };
.Does this issue occur when all extensions are disabled?: Yes
The text was updated successfully, but these errors were encountered: