Skip to content

TypeScript Organize Imports inserts extra newline #36102

@xROAL

Description

@xROAL

TS Template added by @mjbvz

TypeScript Version: 3.8.0-dev.20200108

Search Terms

  • Organize imports

In TypeScript / JavaScript, the command Organize Imports inserts up to two newlines if export { ... }; is at the end of a file. This does not happen with other forms of export.

  • VSCode Version: 1.41.1
  • OS Version: Windows 10 (1803)

Steps to Reproduce:

  1. Have a list / renamed export as the last line of your file, e.g.:
import { Router } from 'express';
const router = Router();
// ... other code
export { router as namedRouter }; // also happens with `export { router };`
  1. Run the Organize Imports command. It will insert a newline after the export { ... };
  2. Run the 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

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: LS: Organize ImportsIssues with the organize imports featureGood First IssueWell scoped, documented and has the green lightHelp WantedYou can do this

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions