Skip to content

feat(format): add swiftformat for Swift files - #41985

Closed
AliAltivate wants to merge 1 commit into
anomalyco:devfrom
AliAltivate:add-swift-format
Closed

feat(format): add swiftformat for Swift files#41985
AliAltivate wants to merge 1 commit into
anomalyco:devfrom
AliAltivate:add-swift-format

Conversation

@AliAltivate

Copy link
Copy Markdown

Issue for this PR

No linked issue.

Type of change

  • New feature

What does this PR do?

Adds a built-in swiftformat formatter for Swift files (.swift). It follows the existing simple binary-detection pattern (like gofmt/gleam): when swiftformat is available on PATH, it runs swiftformat <file> (in-place) on .swift files after they are written or edited. Swift previously had LSP support but no formatter.

Also adds a registry row to the formatters docs table and a test asserting swiftformat is registered for .swift.

How did you verify your code works?

  • Added a test in packages/opencode/test/format/format.test.ts asserting swiftformat is registered with [".swift"] extensions.
  • Ran bun test test/format/format.test.ts — 12 pass, 0 fail.
  • Ran bun typecheck from packages/opencode — clean.

Screenshots / recordings

N/A.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@AliAltivate
AliAltivate deleted the add-swift-format branch August 12, 2026 10:23
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