File tree Expand file tree Collapse file tree 4 files changed +31
-15
lines changed
CSharpier.Tests/FormattingTests/TestFiles/cs Expand file tree Collapse file tree 4 files changed +31
-15
lines changed Original file line number Diff line number Diff line change @@ -8,13 +8,7 @@ class ClassName
88 private string Field;
99
1010 [Obsolete]
11- public string Property
12- {
13- [Obsolete]
14- get;
15- [Obsolete]
16- set;
17- }
11+ public string Property { [Obsolete] get; [Obsolete] set; }
1812
1913 [Obsolete, NonSerialized]
2014 void MethodName([In] string value) { }
@@ -129,3 +123,22 @@ public class ClassName { }
129123 LongName______________________
130124>]
131125public class ClassName { }
126+
127+ public class ClassName
128+ {
129+ public int ShortProperty { get; [SomeAttribute] init; } = 20;
130+
131+ public int CommandTimeout
132+ {
133+ get;
134+ [SomeAttribute]
135+ [SomeOtherAttribute]
136+ set;
137+ }
138+
139+ public int CommandTimeout
140+ {
141+ [SomeAttribute(someValue)]
142+ get;
143+ }
144+ }
Original file line number Diff line number Diff line change @@ -46,13 +46,7 @@ public class ClassName
4646 }
4747 }
4848
49- public string Property
50- {
51- [Obsolete]
52- get;
53- [Obsolete]
54- set;
55- }
49+ public string Property { [Obsolete] get; [Obsolete] set; }
5650
5751 public virtual ICollection<SomeObject> SomeLongNameThatForcesALineBreak______________________ { get; set; } =
5852 new HashSet<SomeObject>();
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ PrintingContext context
1818 is TypeParameterSyntax
1919 or ParameterSyntax
2020 or ParenthesizedLambdaExpressionSyntax
21+ or AccessorDeclarationSyntax
2122 ? Doc . Line
2223 : Doc . HardLine ;
2324
Original file line number Diff line number Diff line change @@ -113,7 +113,15 @@ PrintingContext context
113113 )
114114 {
115115 var docs = new List < Doc > ( ) ;
116- if ( node . AttributeLists . Count > 0 || node . Body != null || node . ExpressionBody != null )
116+ if (
117+ node . AttributeLists . Count > 1
118+ || node . Body != null
119+ || node . ExpressionBody != null
120+ || (
121+ node . AttributeLists . FirstOrDefault ( ) is { } attributeListSyntax
122+ && attributeListSyntax . Attributes . First ( ) . ArgumentList ? . Arguments . Count > 0
123+ )
124+ )
117125 {
118126 docs . Add ( Doc . HardLine ) ;
119127 }
You can’t perform that action at this time.
0 commit comments