Skip to content

Commit

Permalink
Merge pull request #229 from belav/formatting-with-0.9.4
Browse files Browse the repository at this point in the history
formatting with 0.9.4
  • Loading branch information
belav authored May 24, 2021
2 parents bd17e4e + 36c3a08 commit c6edad5
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"csharpier": {
"version": "0.9.2",
"version": "0.9.4",
"commands": [
"dotnet-csharpier"
]
Expand Down
3 changes: 2 additions & 1 deletion Src/CSharpier.Tests/LineEndingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ public void LineEndings_In_Verbatim_String_Should_Respect_Options(
string newLine,
EndOfLine endOfLine
) {
var code = @$"class ClassName
var code =
@$"class ClassName
{{
string value = @""one{newLine}two"";
}}
Expand Down
12 changes: 8 additions & 4 deletions Src/CSharpier.Tests/SyntaxNodeComparerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ namespace Namespace { }
public void Class_Not_Equal_Class_Different_Whitespace()
{
var left = "class ClassName { }";
var right = @"class ClassName {
var right =
@"class ClassName {
}";

var result = this.AreEqual(left, right);
Expand Down Expand Up @@ -79,7 +80,8 @@ public Resources()
}
}
";
var right = @"class Resources
var right =
@"class Resources
{
public Resources() { }
}
Expand Down Expand Up @@ -156,12 +158,14 @@ public DropdownAttribute(bool ignoreIfNotPresent)
[Test]
public void MissingSemiColon()
{
var left = @"public enum Enum
var left =
@"public enum Enum
{
Integer,
String,
};";
var right = @"public enum Enum
var right =
@"public enum Enum
{
Integer,
String,
Expand Down
3 changes: 2 additions & 1 deletion Src/CSharpier/CSharpier.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../../CSharpier.Build.props"/>
<Import Project="../../CSharpier.Build.props" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<PackageId>CSharpier</PackageId>
Expand All @@ -15,6 +15,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CSharpier.MsBuild" Version="0.9.4" />
<PackageReference Include="Ignore" Version="0.1.42" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.8.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
Expand Down
4 changes: 2 additions & 2 deletions Src/CSharpier/DocPrinter/PropagateBreaks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ bool OnEnter(Doc doc)
if (
doc is IBreakParent && (forceFlat == 0 || (forceFlat > 0 && doc is LiteralLine))
) {
if (doc is HardLine { SkipBreakIfFirstInGroup: true } && canSkipBreak)
if (doc is HardLine { SkipBreakIfFirstInGroup: true } && canSkipBreak)
{
if (groupStack.Count > 1)
{
Expand All @@ -59,7 +59,7 @@ bool OnEnter(Doc doc)

alreadyVisitedSet.Add(group);
}
else if (doc is StringDoc { IsDirective: false } )
else if (doc is StringDoc { IsDirective: false })
{
canSkipBreak = false;
}
Expand Down
2 changes: 1 addition & 1 deletion Src/CSharpier/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static async Task<int> Run(
bool skipWrite,
CancellationToken cancellationToken
) {
if (directoryOrFile is null or { Length: 0 } )
if (directoryOrFile is null or { Length: 0 })
{
directoryOrFile = new[] { Directory.GetCurrentDirectory() };
}
Expand Down
2 changes: 1 addition & 1 deletion Src/CSharpier/SyntaxPrinter/Token.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private static Doc PrintSyntaxToken(
&& syntaxToken.Text.StartsWith("@"))
|| (syntaxToken.Kind() == SyntaxKind.InterpolatedStringTextToken
&& syntaxToken.Parent!.Parent
is InterpolatedStringExpressionSyntax { StringStartToken: { RawKind: (int)SyntaxKind.InterpolatedVerbatimStringStartToken } } )
is InterpolatedStringExpressionSyntax { StringStartToken: { RawKind: (int)SyntaxKind.InterpolatedVerbatimStringStartToken } })
) {
var lines = syntaxToken.Text.Replace("\r", string.Empty).Split(new[] { '\n' });
docs.Add(Doc.Join(Doc.LiteralLine, lines.Select(o => new StringDoc(o))));
Expand Down

0 comments on commit c6edad5

Please sign in to comment.