-
Notifications
You must be signed in to change notification settings - Fork 12.8k
source.organizeImports causing extra blank line #48126
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
Minimal repo file: import 'fs'; This returns the following code edit:
|
It seems to top out at 2 trailing newlines, so the process at least reaches a fixed point. This doesn't seem like a priority. |
@RyanCavanaugh If you're using the linting rule 'no-multiple-empty-lines', then saving causes a violation of that rule, and without knowing about the 'File:Save without formatting', you end up in an endless loop. |
I just found this suggestion. Like @RyanCavanaugh said, ignoring one line would be challenging, but I think something like |
Having the same issue here, it's causing us to fail our formatting checking... Would love for this to get fixed |
bump, my prettier conflicts with this |
edit: Correction thought this was a closed issue.
I have this issue too when using vscode I have to manually execute the hotkey in all my files. If the file is an export file (e.g. a rollup file or main export file) then I have to also remove the newline it generates. Its painful. Enabling Example export file that always has a newline appended when organizing imports: export * from './iServiceCollection';
export * from './iServiceCollectionFactory';
export * from './iServiceProvider'; |
In the short term it can be fixed by #36102 (comment). |
… at end of a file fixes microsoft#48126
… at end of a file relates microsoft#48126
… at end of a file relates microsoft#48126
… at end of a file relates microsoft#48126
TS Template added by @mjbvz
TypeScript Version: 4.6.2
Search Terms
Issue Type: Bug
source.organizeImports is adding an extra blank line at the end when the typescript file only has exports. If there are any other lines (e.g. code) after the exports, then the extra line does not get added.
VS Code version: Code 1.65.0 (b5205cc8eb4fbaa726835538cd82372cc0222d43, 2022-03-02T11:12:08.962Z)
OS version: Windows_NT x64 10.0.19044
Restricted Mode: No
Extensions: none
In this project, I've created a new default Angular project and added an index.ts to show the issue.
The text was updated successfully, but these errors were encountered: