简体   繁体   中英

In IntelliJ IDEA, how do I disable the auto-format on simple methods

After making simple methods such as:

    public int getWidth() {
        return game.getWidth();
    }

    public int getHeight() {
        return game.getHeight();
    }

    public Game getGame() {
        return game;
    }

It will be reformatted as:

 public int getWidth() { return game.getWidth();}

    public int getHeight() { return game.getHeight();}

    public Game getGame() { return game;}

In the settings under Editor >> Code Style >> Java >> Keep when reformatting, I have the box for "simple methods in one line" unchecked and it still happens. How can I fix this?

Just saying, it's not that bad since you can click on the method and it expands it.

But you can click File | Settings | Editor | General | Code Folding and click Collapse by Default. Then uncheck One-Line Methods under the Java section.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM