From 4588008a7c5b57fbff97fdfb529c059235cdc7ee Mon Sep 17 00:00:00 2001 From: Hao Song Date: Sun, 28 Jan 2024 18:03:12 -0800 Subject: [PATCH] fix: `swift_format` doesn't respect `.swift-format` file (#283) `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 https://github.com/stevearc/conform.nvim/issues/211 --- lua/conform/formatters/swift_format.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/conform/formatters/swift_format.lua b/lua/conform/formatters/swift_format.lua index e3e43651..1473c194 100644 --- a/lua/conform/formatters/swift_format.lua +++ b/lua/conform/formatters/swift_format.lua @@ -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, }