-
-
Notifications
You must be signed in to change notification settings - Fork 117
Questionable formatting in xml
/csproj
files
#1598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Worst has been for our
To:
|
The xml formatting is a port of prettier's html formatting which is how it ended up this way. I've gotten used to it. <IsTrimmable
Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))"
>true</IsTrimmable
> I don't know that I think this is better, because the <IsTrimmable
Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))">true</IsTrimmable> I'm not opposed to this. Prettier has it as an option but it is not the default. <IsTrimmable
Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))"
>true</IsTrimmable> Another possibility would be treating whitespace as not strict, although that could cause issues if the file being formatted does have strict whitespace. <IsTrimmable Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))">
true
</IsTrimmable>
<!-- except if you have many attributes you don't want them to align with the content -->
<IsTrimmable
Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))"
Condition2="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))">
true
</IsTrimmable>
<!-- vs -->
<IsTrimmable
Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))"
Condition2="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))"
>
true
</IsTrimmable> |
Yeah, unfortunately many MSBuild properties are sensitive to the surrounding whitespace, so can't treat it as non-strict :( |
I generally like the fact that Csharpier picks up XML files now, however some formatting rules are a bit questionable.
Input:
Output:
Expected behavior:
Or, probably better:
Additionally, why does CSharpier remove empty newlines in XML? I think newlines are useful to separate certain element blocks, like
<ItemGroup>
.The text was updated successfully, but these errors were encountered: