Code reformatting prevention needed

Answered

When I code in Java with Intellij, there comes situations where I really want to keep the code in format like the following,

foo(

  a,

  b

);

 

IntelliJ does not let me do this when reformatting. I tried almost every possible solutions (code style change, formatter off) to no avail.

code becomes,

foo(a, b);

 

Now I simply do want to disable the code reformatting feature for someone in our team from accidentally reformatting the code by whatsoever reasons..

or undo the reformatting if it happens.

 

What would be the way? Is there any possibility to use IntelliJ like that?

-

UPDATE 22 Feb

Found the cause. Though I should admit this was my mistake, I would like to share it.

It turned out that 'Eclipse Code Formatter' plugin, which I setup long time ago and left it run in the background, overrode all those formatter:on/off settings and customized code styles. That made the code reformatting distort my code in an unexpected way.

0
2 comments

You can disable code formatting for this region: http://stackoverflow.com/a/19492318/104891.

0

I disabled code formatting for regions as described above. 
Unfortunately It doesn't work with eclipse code formatter. 

When using intellIJ formatter it works OK. 
Once I switch to eclipse formatter it doesn't. 
Is there any way to fix it? 


Version of IDEA I use is: 2017.2.6 (Build #UI-172.4574.11,  Built on November 12, 2017).
The version of eclipse code formater I use is: 17.2.132.637.0.Eclipse_4.7

Edit.:

In order to solve this problem eclipse formatter file needs to be edited. 
Solution described here: https://github.com/krasa/EclipseCodeFormatter/issues/18

0

Please sign in to leave a comment.