|
| 1 | +# 1.2.0 |
| 2 | +## What's Changed |
| 3 | +### Custom XML Parser [#1679](https://github.com/belav/csharpier/pull/1679) |
| 4 | +CSharpier now has a custom xml parser. `XmlDocument` and `XDocument` do not provide the original white space or the original attribute values from the file that was parsed which blocked the ability to implement supporting keeping empty new lines and not automatically encoding attributes. |
| 5 | +### Support for keeping empty lines in xml files [#1599](https://github.com/belav/csharpier/issues/1599) |
| 6 | +CSharpier now supports keeping a single empty line between elements in xml files. It will remove any initial or trailing empty lines. |
| 7 | +```xml |
| 8 | +<!-- input --> |
| 9 | +<Root> |
| 10 | + |
| 11 | + <Element /> |
| 12 | + |
| 13 | + |
| 14 | + <Element /> |
| 15 | + |
| 16 | +</Root> |
| 17 | + |
| 18 | +<!-- expected output --> |
| 19 | +<Root> |
| 20 | + <Element /> |
| 21 | + |
| 22 | + <Element /> |
| 23 | +</Root> |
| 24 | + |
| 25 | +<!-- 1.1.2 --> |
| 26 | +<Root> |
| 27 | + <Element /> |
| 28 | + <Element /> |
| 29 | +</Root> |
| 30 | +``` |
| 31 | +### Xml - don't automatically encode attribute values [#1610](https://github.com/belav/csharpier/issues/1610) |
| 32 | +CSharpier will no longer encode attribute values. It will leave them encoded if they are supplied that way. |
| 33 | +```xml |
| 34 | +<!-- input & expected output --> |
| 35 | +<Target Name="Transform" BeforeTargets="Build"> |
| 36 | + <Message Importance="high" Text="@(MyItems->'MyItems has %(Identity)', ', ')" /> |
| 37 | +</Target> |
| 38 | + |
| 39 | +<!-- 1.1.2 --> |
| 40 | +<Target Name="Transform" BeforeTargets="Build"> |
| 41 | + <Message Importance="high" Text="@(MyItems->'MyItems has %(Identity)', ', ')" /> |
| 42 | +</Target> |
| 43 | +``` |
| 44 | +### Add option to all integrations to report incorrect formatting as a warning instead of error [#1687](https://github.com/belav/csharpier/issues/1687) |
| 45 | + |
| 46 | +### Formatting "using" import split on multiple lines requires formatting it twice to get the expected result [#1698](https://github.com/belav/csharpier/issues/1698) |
| 47 | +When a using contained a newline before the namespace it was not being sorted properly. |
| 48 | +```c# |
| 49 | +// input |
| 50 | +using System.Net; |
| 51 | +using |
| 52 | + SomeProject.Bar; |
| 53 | +using Microsoft.Extensions.Logging; |
| 54 | + |
| 55 | +// expected output |
| 56 | +using System.Net; |
| 57 | +using Microsoft.Extensions.Logging; |
| 58 | +using SomeProject.Bar; |
| 59 | + |
| 60 | +// 1.1.2 |
| 61 | +using System.Net; |
| 62 | +using SomeProject.Bar; |
| 63 | +using Microsoft.Extensions.Logging; |
| 64 | +``` |
| 65 | + |
| 66 | +### An empty line is inserted in lambda [#1694](https://github.com/belav/csharpier/issues/1694) |
| 67 | +CSharpier was inserting an extra blank line in some situations with a lambda and a collection expression |
| 68 | +```c# |
| 69 | +// input & expected output |
| 70 | +CallMethod( |
| 71 | + (parameter1, parameter2) => |
| 72 | + [ |
| 73 | + LongValue________________________________________________, |
| 74 | + LongValue________________________________________________, |
| 75 | + ] |
| 76 | +); |
| 77 | + |
| 78 | +// 1.1.2 |
| 79 | +CallMethod( |
| 80 | + (parameter1, parameter2) => |
| 81 | + |
| 82 | + [ |
| 83 | + LongValue________________________________________________, |
| 84 | + LongValue________________________________________________, |
| 85 | + ] |
| 86 | +); |
| 87 | +``` |
| 88 | + |
| 89 | +### Indent .ThenInclude() for clearer navigation hierarchy in EF Core queries [#1602](https://github.com/belav/csharpier/issues/1602) |
| 90 | +CSharpier now treats `.ThenInclude` as a special case to improve formatting of EF queries |
| 91 | +```c# |
| 92 | +// input & expected output |
| 93 | +websiteQueryable = websiteQueryable |
| 94 | + .Include(o => o.Categories) |
| 95 | + .Include(o => o.Categories) |
| 96 | + .ThenInclude(c => c.Products) |
| 97 | + .Include(o => o.Categories) |
| 98 | + .ThenInclude(c => c.RuleManager) |
| 99 | + .ThenInclude(rm => rm.RuleClauses) |
| 100 | + .Include(o => o.Categories) |
| 101 | + .ThenInclude(c => c.RuleManager) |
| 102 | + .ThenInclude(rm => rm.RuleClauses) |
| 103 | + .ThenInclude(rc => rc.RuleTypeOption); |
| 104 | + |
| 105 | +// 1.1.2 |
| 106 | +websiteQueryable = websiteQueryable |
| 107 | + .Include(o => o.Categories) |
| 108 | + .Include(o => o.Categories) |
| 109 | + .ThenInclude(c => c.Products) |
| 110 | + .Include(o => o.Categories) |
| 111 | + .ThenInclude(c => c.RuleManager) |
| 112 | + .ThenInclude(rm => rm.RuleClauses) |
| 113 | + .Include(o => o.Categories) |
| 114 | + .ThenInclude(c => c.RuleManager) |
| 115 | + .ThenInclude(rm => rm.RuleClauses) |
| 116 | + .ThenInclude(rc => rc.RuleTypeOption); |
| 117 | + |
| 118 | +``` |
| 119 | +### Inconsistent indentation between `is` and other operators [#1601](https://github.com/belav/csharpier/issues/1601) |
| 120 | +Pattern operators were being indented inconsistently with other operators. The formatting is now more consistent |
| 121 | +```c# |
| 122 | +// input & expected output |
| 123 | +var b2 = ( |
| 124 | + System.Environment.SpecialFolder.AdminTools |
| 125 | + is System.Environment.SpecialFolder.AdminTools |
| 126 | + or System.Environment.SpecialFolder.AdminTools |
| 127 | + or System.Environment.SpecialFolder.AdminTools |
| 128 | +); |
| 129 | + |
| 130 | +var b2 = |
| 131 | + System.Environment.SpecialFolder.AdminTools |
| 132 | + is System.Environment.SpecialFolder.AdminTools |
| 133 | + or System.Environment.SpecialFolder.AdminTools |
| 134 | + or System.Environment.SpecialFolder.AdminTools; |
| 135 | + |
| 136 | +var b2 = |
| 137 | + someLongValue____________________________________________ |
| 138 | + == someOtherLongValue______________________________ |
| 139 | + + someOtherLongValue______________________________; |
| 140 | + |
| 141 | +var b2 = ( |
| 142 | + someLongValue____________________________________________ |
| 143 | + == someOtherLongValue______________________________ |
| 144 | + + someOtherLongValue______________________________ |
| 145 | +); |
| 146 | + |
| 147 | +// 1.1.2 |
| 148 | +var b2 = ( |
| 149 | + System.Environment.SpecialFolder.AdminTools |
| 150 | + is System.Environment.SpecialFolder.AdminTools |
| 151 | + or System.Environment.SpecialFolder.AdminTools |
| 152 | + or System.Environment.SpecialFolder.AdminTools |
| 153 | +); |
| 154 | + |
| 155 | +var b2 = |
| 156 | + System.Environment.SpecialFolder.AdminTools |
| 157 | + is System.Environment.SpecialFolder.AdminTools |
| 158 | + or System.Environment.SpecialFolder.AdminTools |
| 159 | + or System.Environment.SpecialFolder.AdminTools; |
| 160 | + |
| 161 | +var b2 = |
| 162 | + someLongValue____________________________________________ |
| 163 | + == someOtherLongValue______________________________ |
| 164 | + + someOtherLongValue______________________________; |
| 165 | + |
| 166 | +var b2 = ( |
| 167 | + someLongValue____________________________________________ |
| 168 | + == someOtherLongValue______________________________ |
| 169 | + + someOtherLongValue______________________________ |
| 170 | +); |
| 171 | + |
| 172 | +``` |
| 173 | +### Error when formatting with an indent size <= 0 [#1741](https://github.com/belav/csharpier/pull/1741) |
| 174 | +Previously csharpier would attempt to format code when indent size was set to 0. This was not intentional and had a number of bugs. CSharpier now error out when encountering an indent size of 0 |
| 175 | + |
| 176 | +### Fix condition causing FirstTargetFramework build property erasure [#1696](https://github.com/belav/csharpier/pull/1696) |
| 177 | +In some situations CSharpier.Msbuild was running into a build failure. |
| 178 | + |
| 179 | +**Full Changelog**: https://github.com/belav/csharpier/compare/1.1.2...1.2.0 |
1 | 180 | # 1.1.2 |
2 | 181 | ## What's Changed |
3 | 182 | ### Inconsistencies with null-coalescing wrapping on method chains [#1573](https://github.com/belav/csharpier/issues/1573) |
@@ -3473,5 +3652,6 @@ Thanks go to @pingzing |
3473 | 3652 |
|
3474 | 3653 |
|
3475 | 3654 |
|
| 3655 | +
|
3476 | 3656 |
|
3477 | 3657 |
|
0 commit comments