Viper Bailey
Viper Bailey

Reputation: 12027

Stop IntelliJ from rewriting my code

Is there a way to tell IntelliJ to stop rewriting my code to match its preferences? I'm especially concerned with this when it comes to code that has already been committed to source control. For example, the following line was mysteriously changed to the second example because IntelliJ preferred the latter spacing.

    assertLess((new Date().getTime()/1000)-8,attrs.mtime);
    assertLess((new Date().getTime() / 1000) - 8, attrs.mtime);

I don't want this to happen. Any ideas?

Upvotes: 1

Views: 151

Answers (2)

vikingsteve
vikingsteve

Reputation: 40438

There is an option in IDE Settings -> Editor -> Smart Keys named Reformat on Paste:

Check it is set to anything other than Reformat Block, for example Indent Each Line.

Upvotes: 1

Andrey Chaschev
Andrey Chaschev

Reputation: 16526

You might need to uncheck this:

enter image description here

Upvotes: 1

Related Questions