Skip to content

Commit b4b51b4

Browse files
authored
Add google-java-format for java (#261)
1 parent d4b49cd commit b4b51b4

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Supported languages
5959
* **HLSL** ([*clang-format*](https://clang.llvm.org/docs/ClangFormat.html))
6060
* **HTML/XHTML/XML** ([*tidy*](http://www.html-tidy.org/))
6161
* **Hy** (Emacs)
62-
* **Java** ([*clang-format*](https://clang.llvm.org/docs/ClangFormat.html), [*astyle*](http://astyle.sourceforge.net/))
62+
* **Java** ([*astyle*](http://astyle.sourceforge.net/), [*clang-format*](https://clang.llvm.org/docs/ClangFormat.html), [*google-java-format*](https://github.com/google/google-java-format))
6363
* **JavaScript/JSON/JSX** ([*prettier*](https://prettier.io/), [*standard*](https://standardjs.com/), [*prettierd*](https://github.com/fsouza/prettierd), [*deno*](https://deno.land/manual/tools/formatter))
6464
* **Jsonnet** ([*jsonnetfmt*](https://jsonnet.org/))
6565
* **Kotlin** ([*ktlint*](https://github.com/shyiko/ktlint))

format-all.el

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
;; - HLSL (clang-format)
6161
;; - HTML/XHTML/XML (tidy)
6262
;; - Hy (Emacs)
63-
;; - Java (clang-format, astyle)
63+
;; - Java (astyle, clang-format, google-java-format)
6464
;; - JavaScript/JSON/JSX (prettier, standard, prettierd, deno)
6565
;; - Jsonnet (jsonnetfmt)
6666
;; - Kotlin (ktlint)
@@ -162,7 +162,7 @@
162162
("HTML+EEX" mix-format)
163163
("HTML+ERB" erb-format)
164164
("Hy" emacs-hy)
165-
("Java" clang-format)
165+
("Java" google-java-format)
166166
("JavaScript" prettier)
167167
("JSON" prettier)
168168
("JSON5" prettier)
@@ -985,6 +985,13 @@ Consult the existing formatters for examples of BODY."
985985
(:features)
986986
(:format (format-all--buffer-easy executable)))
987987

988+
(define-format-all-formatter google-java-format
989+
(:executable "google-java-format")
990+
(:install)
991+
(:languages "Java")
992+
(:features)
993+
(:format (format-all--buffer-easy executable "-")))
994+
988995
(define-format-all-formatter hclfmt
989996
(:executable "hclfmt")
990997
(:install "go install github.com/hashicorp/hcl/v2/cmd/hclfmt@latest")

0 commit comments

Comments
 (0)