Skip to content

Commit

Permalink
Releasing 0.24.0 (#878)
Browse files Browse the repository at this point in the history
  • Loading branch information
belav authored Apr 26, 2023
1 parent d896f6c commit a066013
Show file tree
Hide file tree
Showing 4 changed files with 165 additions and 3 deletions.
162 changes: 162 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,165 @@
# 0.24.0
## What's Changed
#### Formatting named list patterns loses code and causes compilation error [#876](https://github.com/belav/csharpier/issues/876)
```c#
// input & expected output
return list switch
{
[var elem] => elem * elem,
[] => 0,
[..] elems => elems.Sum(e => e + e),
};

// 0.23.0
return list switch
{
[var elem] => elem * elem,
[] => 0,
[..] => elems.Sum(e => e + e),
};

```

Thanks go to @Dragemil for reporting the bug

#### CSharpier.MSBuild does not support usernames or project paths with spaces [#872](https://github.com/belav/csharpier/issues/872)
CSharpier.MSBuild would throw an exception when building a project if the username had a space, or if the project path had a space.

Thanks go to @ooo2003003v2 for reporting the bug.

#### #pragma with long line introduces extra line break [#865](https://github.com/belav/csharpier/issues/865)
```c#
// input & expected output
if (
e is
#pragma warning disable CS0618
BadHttpRequestException
#pragma warning restore CS0618
{
Message: "______________________________________________________________________________________________________________"
}
) { }

// 0.23.0
if (
e is
#pragma warning disable CS0618
BadHttpRequestException
#pragma warning restore CS0618

{
Message: "______________________________________________________________________________________________________________"
}
) { }
```

Thanks go to @Denton-L for reporting the bug

#### Better support for ignore on method attributes [#848](https://github.com/belav/csharpier/issues/848)
```c#
// input
public class AttributesAndMethods
{
// csharpier-ignore - only the first attribute
[Attribute ]
[Attribute ]
public void MethodThatShouldFormat() { }

[Attribute]
// csharpier-ignore - only the second attribute
[Attribute ]
public void MethodThatShouldFormat() { }

[Attribute ]
[Attribute ]
// csharpier-ignore - just the method
public void MethodThatShouldNotFormat( ) { }
}

// 0.23.0
public class AttributesAndMethods
{
// csharpier-ignore - only the first attribute
[Attribute ]
[Attribute ]
public void MethodThatShouldFormat() { }

[Attribute]
// csharpier-ignore - only the second attribute
[Attribute]
public void MethodThatShouldFormat() { }

[Attribute]
[Attribute]
// csharpier-ignore - just the method
public void MethodThatShouldNotFormat() { }
}

// 0.24.0
public class AttributesAndMethods
{
// csharpier-ignore - only the first attribute
[Attribute ]
[Attribute]
public void MethodThatShouldFormat() { }

[Attribute]
// csharpier-ignore - only the second attribute
[Attribute]
public void MethodThatShouldFormat() { }

[Attribute]
[Attribute]
// csharpier-ignore - just the method
public void MethodThatShouldNotFormat() { }
}
```

Thanks go to @Billuc for reporting the bug

#### Ranged ignore applies some formatting when multiple statements are on a line [#846](https://github.com/belav/csharpier/issues/846)
```c#
// input & expected output
void MethodName()
{
// csharpier-ignore-start
var packet = new List<byte>();
packet.Add(0x0f); packet.Add(0x00);
packet.Add(0x00); packet.Add(0x00);
// csharpier-ignore-end
}

// 0.23.0
void MethodName()
{
// csharpier-ignore-start
var packet = new List<byte>();
packet.Add(0x0f);
packet.Add(0x00);
packet.Add(0x00);
packet.Add(0x00);
// csharpier-ignore-end
}
```

Thanks go to @Billuc for reporting the bug

#### Support scoped variables (better handling of unrecognized syntax nodes) [#839](https://github.com/belav/csharpier/issues/839)
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
```c#
scoped Span<byte> span;
```
Thanks go to @Dragemil for reporting the bug
#### Unrecognized syntax nodes lose comments [#869](https://github.com/belav/csharpier/issues/869)
CSharpier now supports printing commends on unrecognized nodes.
```c#
// comment on unrecognized node
scoped Span<byte> span;
```

**Full Changelog**: https://github.com/belav/csharpier/compare/0.23.0...0.24.0


# 0.23.0
## Breaking Changes
#### Make compile errors public when using CSharpier.Core [#799](https://github.com/belav/csharpier/issues/799)
Expand Down
2 changes: 1 addition & 1 deletion CSharpier.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>0.23.0</Version>
<Version>0.24.0</Version>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryUrl>https://github.com/belav/csharpier</RepositoryUrl>
<RepositoryType>git</RepositoryType>
Expand Down
2 changes: 1 addition & 1 deletion Src/Website/docs/CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ This option keeps csharpier running so that multiple files can be formatted. Thi
to drastically improve formatting time.
The input is a '\u0003' delimited list of file names followed by file contents.
The results are written to stdout delimited by \u0003.
For an example of implementing this in code see [this example](https://github.com/belav/csharpier/blob/master/Src/CSharpier.VSCode/src/CSharpierProcessPipeMultipleFiles.ts)
For an example of implementing this in code see [this example](https://github.com/belav/csharpier/blob/main/Src/CSharpier.VSCode/src/CSharpierProcessPipeMultipleFiles.ts)
```bash
$ [FullPathToFile]\u0003[FileContents]\u0003[FullPathToFile]\u0003[FileContents]\u0003 | dotnet csharpier --pipe-multiple-files
public class ClassName
Expand Down
2 changes: 1 addition & 1 deletion Src/Website/docs/ContinuousIntegration.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Normally when using a code formatter like CSharpier, you'll want to ensure that
name: Validate PR
on:
pull_request:
branches: [ master ]
branches: [ main ]
jobs:
check_formatting:
runs-on: ubuntu-latest
Expand Down

0 comments on commit a066013

Please sign in to comment.