Code style rule priorities

Hello,

I've been using IntelliJ for some time now and I ran into a problem with my code style settings. Some examples:

This is how I want it to look:

blockedYLadder =
        gameScreen.getMap().isTileLadderTile((int) gameScreen.getMap().convertToMapUnits(getX() + getEntityWidth() * 0.25f),
                                             
(int) newMapPositionY) ||
        gameScreen.getMap().isTileLadderTile((int) gameScreen.getMap().convertToMapUnits(getX() + getEntityWidth() * 0.75f),
                                             
(int) newMapPositionY);


And this is what I get after running Ctrl+Alt+L:

blockedYLadder = gameScreen.getMap()
                           .isTileLadderTile((int) gameScreen.getMap().convertToMapUnits(getX() + getEntityWidth() * 0.25f),
                                             
(int) newMapPositionY) || gameScreen.getMap().isTileLadderTile(
        (int) gameScreen.getMap().convertToMapUnits(getX() + getEntityWidth() * 0.75f), (int) newMapPositionY);


This is how I want it to look:

 
if (!gameScreen.getMap().isTileLadderTile((int) gameScreen.getMap().convertToMapUnits(getX() + getEntityWidth() * 0.25f),
                                          
(int) gameScreen.getMap().convertToMapUnits(getY())) &&
    !gameScreen.getMap().isTileLadderTile((int) gameScreen.getMap().convertToMapUnits(getX() + getEntityWidth() * 0.75f),
                                          
(int) gameScreen.getMap().convertToMapUnits(getY()))) {
    int mapY = (int) gameScreen.getMap().convertToMapUnits(getY());
    
setY((int) gameScreen.getMap().convertToScreenUnits(mapY));
}


This is what I get:

 
if (!gameScreen.getMap().isTileLadderTile((int) gameScreen.getMap().convertToMapUnits(getX() + getEntityWidth() * 0.25f),
                                          
(int) gameScreen.getMap().convertToMapUnits(getY())) && !gameScreen.getMap()
                                                                                                             .isTileLadderTile(
                                                                                                                     (int) gameScreen
                                                                                                                             
.getMap()
                                                                                                                             .convertToMapUnits(
                                                                                                                                     getX() +
                                                                                                                                     getEntityWidth() *
                                                                                                                                     0.75f),
                                                                                                                     
(int) gameScreen
                                                                                                                             
.getMap()
                                                                                                                             .convertToMapUnits(
                                                                                                                                     getY()))) {
    int mapY = (int) gameScreen.getMap().convertToMapUnits(getY());
    
setY((int) gameScreen.getMap().convertToScreenUnits(mapY));
}


The second example even exceeds the line width I specified (140).
If I enable the keep line breaks option it stays the way I want it when I run the formatter after I did it manually. But that also means that all the other cases with linebreaks in them dont get formatted anymore, which works perfectly otherwise.

Is there a codestyle setting I missed or are there other formatting conventions in these cases I dont know about the formatter can do?



Attachment(s):
flcodestyle.xml

Please sign in to leave a comment.