Skip to content

make organize imports more flexible about import placement #2100

Open
@Techatrix

Description

@Techatrix

The current implementation of source.organizeImports (#2051) always places the imports at the top of the file. Sometimes you find code that has all imports at the bottom of the file or some imports between code. It would be nice if ZLS could handle this.

I can think of two possible solutions:

  1. add a special case where ZLS will place all imports at the bottom of the file (no config option)
  2. never move imports to a different location, only sort imports that are next to each other i.e. not separated by an empty line

The first solution has been implemented #2391. I am going to keep this issue open as there may still be viable to implement the second solution.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions