Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: swiftformat. #46

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
- [x] [taplo](https://github.com/tamasfe/taplo)
- [ ] [shfmt](https://github.com/mvdan/sh)
- [x] [stylua](https://github.com/JohnnyMorganz/StyLua)
- [ ] [swiftformat](https://github.com/nicklockwood/SwiftFormat)
- [x] [swiftformat](https://github.com/nicklockwood/SwiftFormat)
- [ ] [swift-format](https://github.com/apple/swift-format)
- [ ] [sqlfluff](https://github.com/sqlfluff/sqlfluff) as `sqlfluff format`
- [x] [sqlfluff_fix](https://github.com/sqlfluff/sqlfluff) as `sqlfluff fix`
Expand Down
2 changes: 2 additions & 0 deletions lua/guard-collection/formatter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,9 @@ M.stylua = {

M.swiftformat = {
cmd = 'swiftformat',
args = { '--stdinpath' },
stdin = true,
fname = true,
}

M['swift-format'] = {
Expand Down
18 changes: 18 additions & 0 deletions test/formatter/swiftformat.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
describe('swiftformat', function()
it('can format', function()
local ft = require('guard.filetype')
ft('swift'):fmt('swiftformat')
require('guard').setup()

local formatted = require('test.formatter.helper').test_with('swift', {
[[func myFunc() { ]],
[[print("hello") ]],
[[ }]],
})
assert.are.same({
[[func myFunc() {]],
[[ print("hello")]],
[[}]],
}, formatted)
end)
end)
2 changes: 1 addition & 1 deletion test/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pip -qqq install autopep8 black djhtml docformatter flake8 isort pylint yapf cod
npm install -g --silent \
prettier @fsouza/prettierd sql-formatter shellcheck shfmt @taplo/cli @biomejs/biome &
brew install \
hlint ormolu clang-format golines gofumpt detekt &
hlint ormolu clang-format golines gofumpt detekt swiftformat &

# Install standalone binary packages
bin="$HOME/.local/bin"
Expand Down
Loading