Skip to content

Add javafmtFormatJavadoc setting#269

Merged
mkurz merged 1 commit intosbt:mainfrom
mkurz:add-javafmt-format-javadoc-setting
Apr 15, 2026
Merged

Add javafmtFormatJavadoc setting#269
mkurz merged 1 commit intosbt:mainfrom
mkurz:add-javafmt-format-javadoc-setting

Conversation

@mkurz
Copy link
Copy Markdown
Member

@mkurz mkurz commented Apr 15, 2026

Adds a first-class sbt setting for controlling google-java-format's Javadoc formatting behavior:

  • javafmtFormatJavadoc

This follows the same direction as the recent CLI-backed settings such as:

  • javafmtSortImports
  • javafmtRemoveUnusedImports
  • javafmtReflowLongStrings

Instead of requiring users to go through javafmtOptions, the common sbt-facing configuration is now exposed directly as a dedicated setting:

ThisBuild / javafmtFormatJavadoc := false

Why this change?

Since the plugin now runs google-java-format in a forked JVM via its CLI, the natural public API is the set of CLI-backed formatter toggles exposed as normal sbt settings. That makes configuration more explicit and easier to discover in the README, and
reduces reliance on the upstream JavaFormatterOptions object as the primary user-facing API.

This PR also updates the README to clarify the current state of javafmtOptions:

Finally, this adds a scripted test that verifies javafmtFormatJavadoc := false preserves Javadoc content formatting while still applying normal code formatting around it.

@mkurz mkurz merged commit 7df85b3 into sbt:main Apr 15, 2026
2 checks passed
@mkurz mkurz deleted the add-javafmt-format-javadoc-setting branch April 15, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant