Skip to content

Commit

Permalink
Break long attributes consistently (#312)
Browse files Browse the repository at this point in the history
closes #257
  • Loading branch information
belav authored Jun 16, 2021
1 parent 9d59a53 commit 9ad853f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 9 deletions.
19 changes: 16 additions & 3 deletions Src/CSharpier.Tests/TestFiles/AttributeList/AttributeLists.cst
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ class ClassName
// leading before class
class ClassTwo { }

[BigLongAttributeWhatHappensHmmmmmmmmmmmmmmmmmmmmmmmmmmmmm(
"11111111111111111111111111",
"22222222222222222222222222")]
[LongAttributeWithParametersBreaking(
"someValue_____________",
"someValue_____________",
"someValue_____________"
)]
void LongAttribute() { }

public void MethodName([FromBody] SomeParameter parameter)
Expand All @@ -63,3 +65,14 @@ class ClassName
return;
}
}

[
LongAttributeWithParametersBreaking(
"someValue_____________",
"someValue_____________",
"someValue_____________"
),
AnotherAttribute
]
public class ClassName { }

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
class ClassName
{
public static object? FormatValue<[DynamicallyAccessedMembers(
DynamicallyAccessedMemberTypes.All)]
DynamicallyAccessedMemberTypes.All
)]
T>(T value, CultureInfo? culture = null) { }

public readonly StackObjectPool<Dictionary<
Expand Down Expand Up @@ -57,7 +58,8 @@ class ClassName
RemoteAuthenticationState,
RemoteUserAccount
> AddAccountClaimsPrincipalFactory<[DynamicallyAccessedMembers(
DynamicallyAccessedMemberTypes.PublicConstructors)]
DynamicallyAccessedMemberTypes.PublicConstructors
)]
TAccountClaimsPrincipalFactory>(
this IRemoteAuthenticationBuilder<RemoteAuthenticationState, RemoteUserAccount> builder
) where TAccountClaimsPrincipalFactory : AccountClaimsPrincipalFactory<RemoteUserAccount> =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[assembly: System.Copyright(
@"(C)""
2009")]
2009"
)]
class ClassName
{
private string bothLineEndingsPersist = @"\r\n \n";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ public static Doc Print(AttributeListSyntax node)
Node.Print(attributeArgumentNode.Expression)
),
Doc.Line
),
Token.Print(attributeNode.ArgumentList.CloseParenToken)
)
)
),
Doc.SoftLine,
Token.Print(attributeNode.ArgumentList.CloseParenToken)
);
},
Doc.Line
Expand Down

0 comments on commit 9ad853f

Please sign in to comment.