Skip to content

Commit

Permalink
fix: swift_format doesn't respect .swift-format file (#283)
Browse files Browse the repository at this point in the history
`swift-format` won't pick up `.swift-format` config file in stdin mode. We need to set `stdin = false` and `--in-place` to make it work with `conform.nvim`.

[apple/swift-format/README.md](https://github.com/apple/swift-format/blob/e312ede68bd8549381f9e2edfef7e6c176e9a50e/README.md#L129-L131)

> *   `-i/--in-place`: Overwrites the input files when formatting instead of
    printing the results to standard output. _No backup of the original file is
    made before it is overwritten._

Fix #211
  • Loading branch information
NSHaoSong authored Jan 29, 2024
1 parent 03feeb5 commit 4588008
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lua/conform/formatters/swift_format.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ return {
description = "Swift formatter from apple. Requires building from source with `swift build`.",
},
command = "swift-format",
args = { "$FILENAME", "--in-place" },
stdin = false,
}

0 comments on commit 4588008

Please sign in to comment.