Auto-Reformat on Auto-Import

IntelliJ 12.0.2 makes automatically a code-reformat when I'm adding an import-line for new classes via the auto-import shortcut (alt+enter). I tried to disable this but found nothing... does anybody know how to disable automatic code-formatting in this case?

4 comments

It's not possible to disable that.

Denis

0

But in IntelliJ 11 I never had this problem. When I'm working on someones code which is different formatted then mine, I do not want to destroy his formats only by adding new class-imports! Why are those two totally different things (class import & code format) linked to each other? Any Ideas how to get it work like in the previous version?

0

Every time new import is added via quick fix the ide traverses file content and adjusts references when necessary. After that formatter is invoked for all changed elements. It seems that that file traversal marks even unaffected elements as 'dirty' causing formatter to process them.

Please submit corresponding ticket to our tracker if you have stable steps to reproduce the problem.

Meanwhile, a workaround is to confgure a code style profile for that 'alien code' and turn it on while editing it.

Denis

0

After a long time, the problem is still there in IntelliJ 14.0.2

I have captured a short video where you can see autoformat of getter for no reason when using auto-import of "List"...

Please have a look at https://youtrack.jetbrains.com/issue/IDEA-99343 again, thank you!

0

Please sign in to leave a comment.