csharpier
csharpier copied to clipboard
CSharpier is an opinionated code formatter for c#.
```c# class ClassName { void MethodName() { foreach ( var file in new DirectoryInfo( @"C:\Projects\csharpier-repos" ).GetFilesssssssssssssssssss() ) { return; } } } // should be class ClassName { void MethodName()...
```c# Diagnostic.Create( _descriptor, symbolForDiagnostic.DeclaringSyntaxReferences.FirstOrDefault()? .GetSyntax() .GetLocation() ?? Location.None, symbol.ToDisplayString(SymbolDisplayFormat.CSharpShortErrorMessageFormat) ); // should maybe be Diagnostic.Create( _descriptor, symbolForDiagnostic.DeclaringSyntaxReferences.FirstOrDefault()? .GetSyntax() .GetLocation() ?? Location.None, symbol.ToDisplayString(SymbolDisplayFormat.CSharpShortErrorMessageFormat) ); ```
When there are enough chained assignments, things break like this. ```c# storedArguments_______[i] = localVariables[i] = localVariables[i] = Expression.Parameter(parameters[i].ParameterType); ``` But when there aren't enough, you can end up like this...
This is the current set of edge cases for fields with lambdas. Right now they aren't very consistent. ```c# private Func SomeFieldFunc = (someValue) => true; private Func SomeFieldFunc =...
We have logic that keeps the right side of a binary expression on the same line as the left side. There are cases where we don't really want this to...
In the given code, the `,` cannot be outside the `#if`. This leads to it being formatted like so. Can we catch this and avoid breaking after the `,`? ```c#...
A side effect of https://github.com/belav/csharpier/issues/22 is that now extra lines are kept in situations where we would probably want to get rid of them. ```c# public // random comment //...
I feel like we could clean up how this breaks ```c# entity.HasKey( e => new { e.BusinessEntityID, e.PersonID, e.ContactTypeID } ); // could instead be something like entity.HasKey(e => new...
This is currently how it breaks. ```c# type.FieldDefinitionList = new List< CFieldDefinitionDTO____________________________________ > { field }; ``` Maybe it should space brace? Like this? ```c# type.FieldDefinitionList = new List< CFieldDefinitionDTO____________________________________...
```c# var query = _context.Products #if OLD_FROM_SQL .FromSql(sql) #else .FromSqlRaw(sql) #endif