Skip to content

belav/csharpier

Folders and files

NameName
Last commit message
Last commit date
Jan 20, 2025
Mar 15, 2025
Jan 18, 2022
Jan 20, 2025
Jan 20, 2025
Jan 20, 2025
Jan 20, 2025
Jan 20, 2025
Mar 21, 2025
Feb 2, 2025
Feb 2, 2025
Feb 14, 2025
Feb 21, 2022
Feb 14, 2025
Dec 22, 2021
Feb 21, 2025
Jan 10, 2025
Oct 18, 2021
Dec 26, 2024
Feb 14, 2025
Feb 14, 2025
Jan 20, 2025
Jan 16, 2025
Aug 16, 2024
Feb 10, 2021
Sep 24, 2024
Feb 26, 2022
Oct 26, 2024
Jan 22, 2022
Jan 22, 2022
Jan 20, 2025

Repository files navigation

CSharpier

CSharpier is an opinionated code formatter for c#. It uses Roslyn to parse your code and re-prints it using its own rules. The printing process was ported from prettier but has evolved over time.

CSharpier provides a few basic options that affect formatting and has no plans to add more. It follows the Option Philosophy of prettier.

Quick Start

Install CSharpier globally using the following command.

dotnet tool install csharpier -g

Then format the contents of a directory and its children with the following command.

dotnet csharpier .

CSharpier can also format on save in your editor or as a pre-commit hook. Then you can ensure code was formatted with a CI/CD tool.


Read the documentation

Try it out


Before

public class ClassName {
    public void CallMethod() { 
        this.LongUglyMethod("1234567890", "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
    }
}

After

public class ClassName
{
    public void CallMethod()
    {
        this.LongUglyMethod(
            "1234567890",
            "abcdefghijklmnopqrstuvwxyz",
            "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
        );
    }
}

Contributing

See Development Readme

Join Us Discord

Sponsors

Special thanks to the .NET on AWS Open Source Software Fund for sponsoring the ongoing development CSharpier.