Skip to content

source.organizeImports must not remove empty line between import #24324

@mjbvz

Description

@mjbvz

From @nikolay-borzov on May 22, 2018 12:37

Usually imports are organized in groups separated by empty line (e.g. node packages, services, components). I think that organizeImports should respect existing groups and perform organizing within each group.

  • VSCode Version: 1.23.1
  • OS Version: Windows 10 x64

Steps to Reproduce:

  1. Set user settings:
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
  source.organizeImports": true
}
  1. Create .ts file
import path from 'path'

import fs from 'fs'

const currentDir = path.resolve(__dirname)
const data = fs.readdirSync(currentDir)
  1. Press Ctrl+S

  2. Result:

import fs from 'fs'
import path from 'path'

const currentDir = path.resolve(__dirname)
const data = fs.readdirSync(currentDir)

Does this issue occur when all extensions are disabled?: Yes (Disabled TSLint and Prettier)

Copied from original issue: microsoft/vscode#50277

Metadata

Metadata

Assignees

No one assigned

    Labels

    Design LimitationConstraints of the existing architecture prevent this from being fixed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions