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

Add csharpier support #329

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ The format is based on [Keep a Changelog].
[`gleam`](https://github.com/gleam-lang/gleam) ([#325])
* `zig fmt` official formatter for
[zig](https://ziglang.org/) ([#327]).
* `csharpier` for
[C#](https://learn.microsoft.com/en-us/dotnet/csharp/) ([#328]).
* `clang-format` for
[C#](https://learn.microsoft.com/en-us/dotnet/csharp/) ([#328]).

### Bugs fixed
* `apheleia-npx` would use an incorrect path for the Yarn PnP ESM
Expand Down
3 changes: 3 additions & 0 deletions apheleia-formatters.el
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
(cljfmt . ("cljfmt" "fix" "-"))
(cmake-format . ("cmake-format" "-"))
(crystal-tool-format . ("crystal" "tool" "format" "-"))
(csharpier . ("dotnet-csharpier" "--write-stdout"))
(css-beautify "css-beautify" "--file" "-" "--end-with-newline"
(apheleia-formatters-indent
"--indent-with-tabs" "--indent-size"))
Expand Down Expand Up @@ -313,6 +314,8 @@ rather than using this system."
(conf-toml-mode . dprint)
(cperl-mode . perltidy)
(crystal-mode . crystal-tool-format)
(csharp-mode . clang-format)
(csharp-ts-mode . clang-format)
(css-mode . prettier-css)
(css-ts-mode . prettier-css)
(dart-mode . dart-format)
Expand Down
8 changes: 8 additions & 0 deletions test/formatters/installers/csharpier.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apt-get install -y dotnet-sdk-8.0

dotnet tool install csharpier -g

if ! [[ "$PATH" =~ $HOME/.dotnet/tools:$HOME/bin: ]]; then
PATH="$HOME/.dotnet/tools:$HOME/bin:$PATH"
fi
export PATH
5 changes: 5 additions & 0 deletions test/formatters/samplecode/csharpier/in.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public class ClassName {
public void CallMethod() {
this.LongUglyMethod("1234567890", "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
}
}
11 changes: 11 additions & 0 deletions test/formatters/samplecode/csharpier/out.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
public class ClassName
{
public void CallMethod()
{
this.LongUglyMethod(
"1234567890",
"abcdefghijklmnopqrstuvwxyz",
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
);
}
}
Loading