Skip to content

IntelliJ automatically optimizes imports on some file changes #46

@Vladislav0Art

Description

@Vladislav0Art

Description

File imports are optimized on some file operations (one I noticed: when I rename a class A, A is referenced in B, and B contains optimizable imports -> B's imports are optimized).

This import optimization should NOT occur during plugin execution (if affects how patches are created, leading to incorrect patches).

Solution

Prevent import optimization whatsoever. There is a CodeStyle instance of Project that has the following field setters (they define the limit on which the optimization happens):

ij_java_class_count_to_use_import_on_demand = 5
ij_java_names_count_to_use_import_on_demand = 3

ij_kotlin_name_count_to_use_star_import = 5
ij_kotlin_name_count_to_use_star_import_for_members = 3

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions