aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoah Zhu <virezox@gmail.com>2023-10-02 10:31:54 -0500
committerGitHub <noreply@github.com>2023-10-02 08:31:54 -0700
commite8877369df244515af20e18bf1307632fc638d2a (patch)
tree4cbb77ee4838e398deaa7e121b0a6277e5934456
parentb56bba09a05f045ba266a10abd67279d81812c0b (diff)
feat: add 'google-java-format' formatter (#99)
Co-authored-by: Noah Zhu <noah@Noahs-M2-MacBook-Pro-16.local>
-rw-r--r--README.md1
-rw-r--r--lua/conform/formatters/google-java-format.lua9
2 files changed, 10 insertions, 0 deletions
diff --git a/README.md b/README.md
index 78fec07..3289b2a 100644
--- a/README.md
+++ b/README.md
@@ -192,6 +192,7 @@ To view configured and available formatters, as well as to see the log file, run
- [gofumpt](https://github.com/mvdan/gofumpt) - Enforce a stricter format than gofmt, while being backwards compatible. That is, gofumpt is happy with a subset of the formats that gofmt is happy with.
- [goimports](https://pkg.go.dev/golang.org/x/tools/cmd/goimports) - Updates your Go import lines, adding missing ones and removing unreferenced ones.
- [golines](https://github.com/segmentio/golines) - A golang formatter that fixes long lines
+- [google-java-format](https://github.com/google/google-java-format) - Reformats Java source code according to Google Java Style.
- [htmlbeautifier](https://github.com/threedaymonk/htmlbeautifier) - A normaliser/beautifier for HTML that also understands embedded Ruby. Ideal for tidying up Rails templates.
- [indent](https://www.gnu.org/software/indent/) - GNU Indent
- [injected](lua/conform/formatters/injected.lua) - Format treesitter injected languages.
diff --git a/lua/conform/formatters/google-java-format.lua b/lua/conform/formatters/google-java-format.lua
new file mode 100644
index 0000000..8bcb82a
--- /dev/null
+++ b/lua/conform/formatters/google-java-format.lua
@@ -0,0 +1,9 @@
+---@type conform.FileFormatterConfig
+return {
+ meta = {
+ url = "https://github.com/google/google-java-format",
+ description = "Reformats Java source code according to Google Java Style.",
+ },
+ command = "google-java-format",
+ args = { "-" },
+}