From 880aa379f91ed36c328806846f7c1eca9b49241e Mon Sep 17 00:00:00 2001 From: devkvlt <90241956+devkvlt@users.noreply.github.com> Date: Sat, 21 Dec 2024 15:01:07 +0100 Subject: [PATCH] feat: add format-dune-file (#602) --- README.md | 1 + doc/conform.txt | 1 + lua/conform/formatters/format-dune-file.lua | 10 ++++++++++ 3 files changed, 12 insertions(+) create mode 100644 lua/conform/formatters/format-dune-file.lua diff --git a/README.md b/README.md index 61e482fb..7b30d7f9 100644 --- a/README.md +++ b/README.md @@ -238,6 +238,7 @@ You can view this list in vim with `:help conform-formatters` - [fixjson](https://github.com/rhysd/fixjson) - JSON Fixer for Humans using (relaxed) JSON5. - [fnlfmt](https://git.sr.ht/~technomancy/fnlfmt) - A formatter for Fennel code. - [forge_fmt](https://github.com/foundry-rs/foundry) - Forge is a command-line tool that ships with Foundry. Forge tests, builds, and deploys your smart contracts. +- [format-dune-file](https://github.com/ocaml/dune) - Auto-formatter for Dune files. - [format-queries](https://github.com/nvim-treesitter/nvim-treesitter/blob/main/CONTRIBUTING.md#formatting) - Tree-sitter query formatter. - [fourmolu](https://hackage.haskell.org/package/fourmolu) - A fork of ormolu that uses four space indentation and allows arbitrary configuration. - [fprettify](https://github.com/fortran-lang/fprettify) - Auto-formatter for modern fortran source code. diff --git a/doc/conform.txt b/doc/conform.txt index 74b4fbf3..40858fdc 100644 --- a/doc/conform.txt +++ b/doc/conform.txt @@ -331,6 +331,7 @@ FORMATTERS *conform-formatter `fnlfmt` - A formatter for Fennel code. `forge_fmt` - Forge is a command-line tool that ships with Foundry. Forge tests, builds, and deploys your smart contracts. +`format-dune-file` - Auto-formatter for Dune files. `format-queries` - Tree-sitter query formatter. `fourmolu` - A fork of ormolu that uses four space indentation and allows arbitrary configuration. diff --git a/lua/conform/formatters/format-dune-file.lua b/lua/conform/formatters/format-dune-file.lua new file mode 100644 index 00000000..fde16e4d --- /dev/null +++ b/lua/conform/formatters/format-dune-file.lua @@ -0,0 +1,10 @@ +---@type conform.FileFormatterConfig +return { + meta = { + url = "https://github.com/ocaml/dune", + description = "Auto-formatter for Dune files.", + }, + command = "dune", + args = { "format-dune-file" }, + stdin = true, +}