From f8c64b835f60a80639375500a80e8cd303d8eda6 Mon Sep 17 00:00:00 2001 From: Mads Hougesen Date: Mon, 18 Mar 2024 18:48:07 +0100 Subject: [PATCH] feat: support crystal tool format (#344) --- README.md | 1 + doc/conform.txt | 1 + lua/conform/formatters/crystal.lua | 10 ++++++++++ 3 files changed, 12 insertions(+) create mode 100644 lua/conform/formatters/crystal.lua diff --git a/README.md b/README.md index 4c30f08..9c6b546 100644 --- a/README.md +++ b/README.md @@ -201,6 +201,7 @@ You can view this list in vim with `:help conform-formatters` - [cljstyle](https://github.com/greglook/cljstyle) - Formatter for Clojure code. - [cmake_format](https://github.com/cheshirekow/cmake_format) - Parse cmake listfiles and format them nicely. - [codespell](https://github.com/codespell-project/codespell) - Check code for common misspellings. +- [crystal](https://crystal-lang.org/) - Format Crystal code. - [csharpier](https://github.com/belav/csharpier) - The opinionated C# code formatter. - [cue_fmt](https://cuelang.org) - Format CUE files using `cue fmt` command. - [darker](https://github.com/akaihola/darker) - Run black only on changed lines. diff --git a/doc/conform.txt b/doc/conform.txt index d0ffda2..fb3ff77 100644 --- a/doc/conform.txt +++ b/doc/conform.txt @@ -208,6 +208,7 @@ FORMATTERS *conform-formatter `cljstyle` - Formatter for Clojure code. `cmake_format` - Parse cmake listfiles and format them nicely. `codespell` - Check code for common misspellings. +`crystal`- Format Crystal code. `csharpier` - The opinionated C# code formatter. `cue_fmt` - Format CUE files using `cue fmt` command. `darker` - Run black only on changed lines. diff --git a/lua/conform/formatters/crystal.lua b/lua/conform/formatters/crystal.lua new file mode 100644 index 0000000..1f9e12b --- /dev/null +++ b/lua/conform/formatters/crystal.lua @@ -0,0 +1,10 @@ +---@type conform.FileFormatterConfig +return { + meta = { + url = "https://crystal-lang.org/", + description = "Format Crystal code.", + }, + command = "crystal", + args = { "tool", "format", "-" }, + stdin = true, +}