|
| 1 | +# 0.24.0 |
| 2 | +## What's Changed |
| 3 | +#### Formatting named list patterns loses code and causes compilation error [#876](https://github.com/belav/csharpier/issues/876) |
| 4 | +```c# |
| 5 | +// input & expected output |
| 6 | +return list switch |
| 7 | +{ |
| 8 | + [var elem] => elem * elem, |
| 9 | + [] => 0, |
| 10 | + [..] elems => elems.Sum(e => e + e), |
| 11 | +}; |
| 12 | + |
| 13 | +// 0.23.0 |
| 14 | +return list switch |
| 15 | +{ |
| 16 | + [var elem] => elem * elem, |
| 17 | + [] => 0, |
| 18 | + [..] => elems.Sum(e => e + e), |
| 19 | +}; |
| 20 | + |
| 21 | +``` |
| 22 | + |
| 23 | +Thanks go to @Dragemil for reporting the bug |
| 24 | + |
| 25 | +#### CSharpier.MSBuild does not support usernames or project paths with spaces [#872](https://github.com/belav/csharpier/issues/872) |
| 26 | +CSharpier.MSBuild would throw an exception when building a project if the username had a space, or if the project path had a space. |
| 27 | + |
| 28 | +Thanks go to @ooo2003003v2 for reporting the bug. |
| 29 | + |
| 30 | +#### #pragma with long line introduces extra line break [#865](https://github.com/belav/csharpier/issues/865) |
| 31 | +```c# |
| 32 | +// input & expected output |
| 33 | +if ( |
| 34 | + e is |
| 35 | +#pragma warning disable CS0618 |
| 36 | + BadHttpRequestException |
| 37 | +#pragma warning restore CS0618 |
| 38 | + { |
| 39 | + Message: "______________________________________________________________________________________________________________" |
| 40 | + } |
| 41 | +) { } |
| 42 | + |
| 43 | +// 0.23.0 |
| 44 | +if ( |
| 45 | + e is |
| 46 | +#pragma warning disable CS0618 |
| 47 | + BadHttpRequestException |
| 48 | +#pragma warning restore CS0618 |
| 49 | + |
| 50 | + { |
| 51 | + Message: "______________________________________________________________________________________________________________" |
| 52 | + } |
| 53 | +) { } |
| 54 | +``` |
| 55 | + |
| 56 | +Thanks go to @Denton-L for reporting the bug |
| 57 | + |
| 58 | +#### Better support for ignore on method attributes [#848](https://github.com/belav/csharpier/issues/848) |
| 59 | +```c# |
| 60 | +// input |
| 61 | +public class AttributesAndMethods |
| 62 | +{ |
| 63 | + // csharpier-ignore - only the first attribute |
| 64 | + [Attribute ] |
| 65 | + [Attribute ] |
| 66 | + public void MethodThatShouldFormat() { } |
| 67 | + |
| 68 | + [Attribute] |
| 69 | + // csharpier-ignore - only the second attribute |
| 70 | + [Attribute ] |
| 71 | + public void MethodThatShouldFormat() { } |
| 72 | + |
| 73 | + [Attribute ] |
| 74 | + [Attribute ] |
| 75 | + // csharpier-ignore - just the method |
| 76 | + public void MethodThatShouldNotFormat( ) { } |
| 77 | +} |
| 78 | + |
| 79 | +// 0.23.0 |
| 80 | +public class AttributesAndMethods |
| 81 | +{ |
| 82 | + // csharpier-ignore - only the first attribute |
| 83 | + [Attribute ] |
| 84 | + [Attribute ] |
| 85 | + public void MethodThatShouldFormat() { } |
| 86 | + |
| 87 | + [Attribute] |
| 88 | + // csharpier-ignore - only the second attribute |
| 89 | + [Attribute] |
| 90 | + public void MethodThatShouldFormat() { } |
| 91 | + |
| 92 | + [Attribute] |
| 93 | + [Attribute] |
| 94 | + // csharpier-ignore - just the method |
| 95 | + public void MethodThatShouldNotFormat() { } |
| 96 | +} |
| 97 | + |
| 98 | +// 0.24.0 |
| 99 | +public class AttributesAndMethods |
| 100 | +{ |
| 101 | + // csharpier-ignore - only the first attribute |
| 102 | + [Attribute ] |
| 103 | + [Attribute] |
| 104 | + public void MethodThatShouldFormat() { } |
| 105 | + |
| 106 | + [Attribute] |
| 107 | + // csharpier-ignore - only the second attribute |
| 108 | + [Attribute] |
| 109 | + public void MethodThatShouldFormat() { } |
| 110 | + |
| 111 | + [Attribute] |
| 112 | + [Attribute] |
| 113 | + // csharpier-ignore - just the method |
| 114 | + public void MethodThatShouldNotFormat() { } |
| 115 | +} |
| 116 | +``` |
| 117 | + |
| 118 | +Thanks go to @Billuc for reporting the bug |
| 119 | + |
| 120 | +#### Ranged ignore applies some formatting when multiple statements are on a line [#846](https://github.com/belav/csharpier/issues/846) |
| 121 | +```c# |
| 122 | +// input & expected output |
| 123 | +void MethodName() |
| 124 | +{ |
| 125 | + // csharpier-ignore-start |
| 126 | + var packet = new List<byte>(); |
| 127 | + packet.Add(0x0f); packet.Add(0x00); |
| 128 | + packet.Add(0x00); packet.Add(0x00); |
| 129 | + // csharpier-ignore-end |
| 130 | +} |
| 131 | + |
| 132 | +// 0.23.0 |
| 133 | +void MethodName() |
| 134 | +{ |
| 135 | + // csharpier-ignore-start |
| 136 | + var packet = new List<byte>(); |
| 137 | + packet.Add(0x0f); |
| 138 | +packet.Add(0x00); |
| 139 | + packet.Add(0x00); |
| 140 | +packet.Add(0x00); |
| 141 | + // csharpier-ignore-end |
| 142 | +} |
| 143 | +``` |
| 144 | + |
| 145 | +Thanks go to @Billuc for reporting the bug |
| 146 | + |
| 147 | +#### Support scoped variables (better handling of unrecognized syntax nodes) [#839](https://github.com/belav/csharpier/issues/839) |
| 148 | +Scoped variables are a language proposal. CSharpier has some support for printing unrecognized syntax nodes but the validation logic didn't account for them and would throw an exception |
| 149 | +```c# |
| 150 | +scoped Span<byte> span; |
| 151 | +``` |
| 152 | +Thanks go to @Dragemil for reporting the bug |
| 153 | +#### Unrecognized syntax nodes lose comments [#869](https://github.com/belav/csharpier/issues/869) |
| 154 | +CSharpier now supports printing commends on unrecognized nodes. |
| 155 | +```c# |
| 156 | +// comment on unrecognized node |
| 157 | +scoped Span<byte> span; |
| 158 | +``` |
| 159 | + |
| 160 | +**Full Changelog**: https://github.com/belav/csharpier/compare/0.23.0...0.24.0 |
| 161 | + |
| 162 | + |
1 | 163 | # 0.23.0 |
2 | 164 | ## Breaking Changes |
3 | 165 | #### Make compile errors public when using CSharpier.Core [#799](https://github.com/belav/csharpier/issues/799) |
|
0 commit comments