From b2368ff18a9dd9452170d3a6f41b1f872ae5d0b2 Mon Sep 17 00:00:00 2001 From: Jesper Lundberg Date: Sat, 28 Oct 2023 20:27:02 +0200 Subject: [PATCH] feat: add CSharpier (#165) * Add formatter and update readme and conform.txt * Remove unused variable --- README.md | 3 ++- doc/conform.txt | 1 + lua/conform/formatters/csharpier.lua | 10 ++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 lua/conform/formatters/csharpier.lua diff --git a/README.md b/README.md index 3a6373aa..593fd254 100644 --- a/README.md +++ b/README.md @@ -190,6 +190,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. +- [csharpier](https://github.com/belav/csharpier) - An opinionated C# formatter. - [darker](https://github.com/akaihola/darker) - Run black only on changed lines. - [dart_format](https://dart.dev/tools/dart-format) - Replace the whitespace in your program with formatting that follows Dart guidelines. - [deno_fmt](https://deno.land/manual/tools/formatter) - Use [Deno](https://deno.land/) to format TypeScript, JavaScript/JSON and markdown. @@ -494,7 +495,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` \ @@ -513,6 +513,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 | + ## Acknowledgements diff --git a/doc/conform.txt b/doc/conform.txt index 82d7bea9..ac592304 100644 --- a/doc/conform.txt +++ b/doc/conform.txt @@ -180,6 +180,7 @@ FORMATTERS *conform-formatter `cljstyle` - Formatter for Clojure code. `cmake_format` - Parse cmake listfiles and format them nicely. `codespell` - Check code for common misspellings. +csharpier - An opinionated C# formatter. `darker` - Run black only on changed lines. `dart_format` - Replace the whitespace in your program with formatting that follows Dart guidelines. diff --git a/lua/conform/formatters/csharpier.lua b/lua/conform/formatters/csharpier.lua new file mode 100644 index 00000000..50258e0f --- /dev/null +++ b/lua/conform/formatters/csharpier.lua @@ -0,0 +1,10 @@ +---@type conform.FileFormatterConfig +return { + meta = { + url = "https://github.com/belav/csharpier", + description = "The opinionated C# code formatter", + }, + command = "dotnet-csharpier", + args = { "--write-stdout" }, + stdin = true, +}