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
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
CodeStyleinstance ofProjectthat has the following field setters (they define the limit on which the optimization happens):