Skip to content

Commit

Permalink
feat: add formatter sqlfmt (#307)
Browse files Browse the repository at this point in the history
  • Loading branch information
MattiasMTS committed Feb 22, 2024
1 parent bfae1d8 commit 015f9e9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ You can view this list in vim with `:help conform-formatters`
- [shfmt](https://github.com/mvdan/sh) - A shell parser, formatter, and interpreter with `bash` support.
- [sql_formatter](https://github.com/sql-formatter-org/sql-formatter) - A whitespace formatter for different query languages.
- [sqlfluff](https://github.com/sqlfluff/sqlfluff) - A modular SQL linter and auto-formatter with support for multiple dialects and templated code.
- [sqlfmt](https://docs.sqlfmt.com) - sqlfmt formats your dbt SQL files so you don't have to. It is similar in nature to Black, gofmt, and rustfmt (but for SQL).
- [squeeze_blanks](https://www.gnu.org/software/coreutils/manual/html_node/cat-invocation.html#cat-invocation) - Squeeze repeated blank lines into a single blank line via `cat -s`.
- [standardjs](https://standardjs.com) - JavaScript Standard style guide, linter, and formatter.
- [standardrb](https://github.com/standardrb/standard) - Ruby's bikeshed-proof linter and formatter.
Expand Down Expand Up @@ -547,7 +548,6 @@ Retrieve the available formatters for a buffer
`list_all_formatters(): conform.FormatterInfo[]` \
List information about all filetype-configured formatters


### get_formatter_info(formatter, bufnr)

`get_formatter_info(formatter, bufnr): conform.FormatterInfo` \
Expand All @@ -566,6 +566,7 @@ Check if the buffer will use LSP formatting when lsp_fallback = true
| Param | Type | Desc |
| ------- | ------------ | ------------------------------------ |
| options | `nil\|table` | Options passed to vim.lsp.buf.format |

<!-- /API -->

## Acknowledgements
Expand Down
9 changes: 9 additions & 0 deletions lua/conform/formatters/sqlfmt.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://docs.sqlfmt.com",
description = "sqlfmt formats your dbt SQL files so you don't have to. It is similar in nature to Black, gofmt, and rustfmt (but for SQL)",
},
command = "sqlfmt",
args = { "-" },
}

0 comments on commit 015f9e9

Please sign in to comment.