This plugin makes use of the dotnet tool CSharpier to format your code. CSharpier 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.
The plugin determines which version of csharpier is needed to format a give file by looking for a dotnet manifest file. If one is not found it looks for a globally installed version of CSharpier.
- Install csharpier
- as a local tool versioned to your project with
dotnet tool install csharpier
- globally with
dotnet tool install -g csharpier
- as a local tool versioned to your project with
- Use the
Reformat with CSharpier
action.- Available when right clicking on a file in the editor
- Available via "Search Everywhere"
- Does not have a default keyboard shortcut but can be assigned one.
- Optionally configure CSharpier to
Run on Save
under Preferences/Settings | Tools | CSharpier
Please report any issues
-
Using IDE built-in plugin system:
Settings/Preferences > Plugins > Marketplace > Search for "CSharpier" > Install Plugin
See Editor Troubleshooting for more information.
Note This plugin does not do any formatting and is versioned separately from CSharpier.
- Use the action "Show Log in Explorer"
- Look for entries for "CSharpierLogger"
- Use the action "Debug Log Settings"
- Add entry for "#com.intellij.csharpier.CSharpierLogger"
- Restart Rider