在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):google/google-java-format开源软件地址(OpenSource Url):https://github.com/google/google-java-format开源编程语言(OpenSource Language):Java 98.4%开源软件介绍(OpenSource Introduction):google-java-format
Using the formatterfrom the command-lineDownload the formatter and run it with:
The formatter can act on whole files, on limited lines ( To reformat changed lines in a specific patch, use
Note: There is no configurability as to the formatter's algorithm for formatting. This is a deliberate design decision to unify our code formatting on a single format. IntelliJ, Android Studio, and other JetBrains IDEsA
google-java-format IntelliJ plugin
is available from the plugin repository. To install it, go to your IDE's
settings and select the The plugin will be disabled by default. To enable it in the current project, go
to To enable it by default in new projects, use When enabled, it will replace the normal The import ordering is not handled by this plugin, unfortunately. To fix the import order, download the IntelliJ Java Google Style file and import it into File→Settings→Editor→Code Style. EclipseThe latest version of the The plugin adds a Third-party integrations
as a libraryThe formatter can be used in software which generates java to output more legible java code. Just include the library in your maven/gradle/etc. configuration.
Maven<dependency>
<groupId>com.google.googlejavaformat</groupId>
<artifactId>google-java-format</artifactId>
<version>${google-java-format.version}</version>
</dependency> Gradledependencies {
implementation 'com.google.googlejavaformat:google-java-format:$googleJavaFormatVersion'
} You can then use the formatter through the String formattedSource = new Formatter().formatSource(sourceString); or CharSource source = ...
CharSink output = ...
new Formatter().formatSource(source, output); Your starting point should be the instance methods of
Building from source
ContributingPlease see the contributors guide for details. License
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论