Add scalafmt formatter support for Scala files #8236

Open
opened 2026-02-16 18:09:29 -05:00 by yindo · 1 comment
Owner

Originally created by @kaplan-shaked on GitHub (Feb 1, 2026).

Originally assigned to: @thdxr on GitHub.

Description

Add support for the scalafmt formatter to automatically format Scala files (.scala, .sbt, .sc) when they are edited in OpenCode.

Requirements

The formatter should:

  • Support .scala, .sbt, and .sc file extensions
  • Use the scalafmt command
  • Only be enabled when both the scalafmt command is available and a .scalafmt.conf config file exists in the project
  • Follow the same pattern as other config-based formatters (ocamlformat, clang-format)

Implementation

  • Add scalafmt formatter definition in packages/opencode/src/format/formatter.ts
  • Update formatter documentation in packages/web/src/content/docs/formatters.mdx
Originally created by @kaplan-shaked on GitHub (Feb 1, 2026). Originally assigned to: @thdxr on GitHub. ## Description Add support for the scalafmt formatter to automatically format Scala files (.scala, .sbt, .sc) when they are edited in OpenCode. ## Requirements The formatter should: - Support `.scala`, `.sbt`, and `.sc` file extensions - Use the `scalafmt` command - Only be enabled when both the `scalafmt` command is available and a `.scalafmt.conf` config file exists in the project - Follow the same pattern as other config-based formatters (ocamlformat, clang-format) ## Implementation - Add scalafmt formatter definition in `packages/opencode/src/format/formatter.ts` - Update formatter documentation in `packages/web/src/content/docs/formatters.mdx`
yindo added the docs label 2026-02-16 18:09:29 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Feb 1, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #10685: [FEATURE]: Add Metals as the Scala LSP - while this requests LSP support rather than a formatter, it indicates related interest in Scala language support. Consider checking if there are any overlapping implementation needs or user requirements.

Feel free to ignore if this doesn't address your specific case.

@github-actions[bot] commented on GitHub (Feb 1, 2026): This issue might be a duplicate of existing issues. Please check: - #10685: [FEATURE]: Add Metals as the Scala LSP - while this requests LSP support rather than a formatter, it indicates related interest in Scala language support. Consider checking if there are any overlapping implementation needs or user requirements. Feel free to ignore if this doesn't address your specific case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8236