How to configure Google Java Code Formatter in Intellij IDEA 17?

后端 未结 5 483
面向向阳花
面向向阳花 2021-01-31 13:55

In the latest versions of IntelliJ IDEA it seems that it isn\'t possible to import code style files like intellij-java-google-style.xml.

I would like use the Google Java

5条回答
  •  清酒与你
    2021-01-31 14:47

    This problem can be solve installing the google-java-format Plugin.

    1. Open plugins window (CTRL+Shift+A): plugins

    2. Click on browse repositories.

    3. Search for google-java-format

    4. Install the plugin.

    5. Restart the IDE.

    6. Enable the plugin executing the action (Ctrl+Shift+A): Reformat with google-java-format

    Additional notes from the google-java-format README

    The plugin will be disabled by default. To enable it in the current project, go to File→Settings...→google-java-format Settings (or IntelliJ IDEA→Preferences...→Other Settings→google-java-format Settings on macOS) and check the Enable google-java-format checkbox. (A notification will be presented when you first open a project offering to do this for you.)

    To enable it by default in new projects, use File→Other Settings→Default Settings....

提交回复
热议问题