How to stop anti-aliasing of poor APIs in IntelliJ

I use IntelliJ IDEA 13.1.5 to write Java code that uses the free APIs, and I noticed that when I close the block around the "smooth" part of the code, then IDEA automatically aligns the "free" code in one line,

For example, if I have this method:

public int sendMessage(Message message) { Response response = JerseyClientHelper.target(serverUrl) .header("User-Agent", userAgent) .post(Entity.entity(message)); return response.getStatus(); } 

and I'm trying to wrap it in a new if block, then I would print an if condition and open the block:

 public int sendMessage(Message message) { if (message != null) { Response response = JerseyClientHelper.target(serverUrl) .header("User-Agent", userAgent) .post(Entity.entity(message)); return response.getStatus(); // Didn't type the '}' to close the block yet } 

but as soon as I type } , to close the block, IntelliJ aligns the code in one line:

 public int sendMessage(Message message) { if (message != null) { Response response = JerseyClientHelper.target(serverUrl).header("User-Agent", userAgent).post(Entity.entity(message)); return response.getStatus(); } } 

Is there a way to disable auto-alignment of poor APIs? I looked through the sections "Code Style β†’ Java" and "Code Style β†’ General", but could not find anything that would be specifically related to this.

+6
source share
1 answer

settings> code style> java> wrapper and curly braces> calls with call chain

(in version 14)

looks like this

 myInstance.call() .again() .eclipseIsRubbish(true) .cestfin(); 
+14
source

Source: https://habr.com/ru/post/976802/


All Articles