Skip to content
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

Releasing 0.27.3 #1181

Merged
merged 1 commit into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 136 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,138 @@
# 0.27.2
# 0.27.3
## What's Changed
### Add more options to CodeFormatterOptions [#1172](https://github.com/belav/csharpier/issues/1172)
The API for CSharpier was only exposing `CodeFormatterOptions.PrintWidth`. It is now in sync with the CLI and exposes all of the available options
```c#
public class CodeFormatterOptions
{
public int Width { get; init; } = 100;
public IndentStyle IndentStyle { get; init; } = IndentStyle.Spaces;
public int IndentSize { get; init; } = 4;
public EndOfLine EndOfLine { get; init; } = EndOfLine.Auto;
}
```

Thanks go to @Phault for the contribution
### Extra indent when call method on RawStringLiteral [#1169](https://github.com/belav/csharpier/issues/1169)
When a raw string literal was the first argument to a method call, it was getting an extra indent.

```c#
// input & expected output
CallMethod(
"""
SomeRawString
""".CallMethod()
);

// 0.27.2
CallMethod(
"""
SomeRawString
""".CallMethod()
);

```

Thanks go to @Rudomitori for reporting the bug.
### Using aliases sorting is not always the same depending on the input order [#1168](https://github.com/belav/csharpier/issues/1168)
Using aliases were not sorting properly, resulting differing outputs and unstable formatting.

Inputs of

```c#
using A = string;
using B = string;
using C = string;
using D = string;
```
And
```c#
using D = string;
using C = string;
using B = string;
using A = string;
```
Now always result in properly sorted output of
```c#
using A = string;
using B = string;
using C = string;
using D = string;
```

Thanks go to @Araxor for reporting the bug.
### Spread (in collection expression) are not formatted [#1167](https://github.com/belav/csharpier/issues/1167)
The spread element was unformatted, and left as is. It is now formatted as follows.
```c#
int[] someArray = [.. someOtherArray];
int[] someOtherArray = [.. value1, .. value2, .. value3];

int[] someOtherArray =
[
.. value1________________________________,
.. value2________________________________,
.. value3________________________________
];
```

Thanks go to @jods4 for reporting the bug.
### Fix empty line before collection expression in attribute [#1164](https://github.com/belav/csharpier/pull/1160)
A collection expression in an attribute resulted in an extra line before the collection expression.
```c#
// input & expected output
[SomeAttribute(
[
someValue_______________________________________________,
someValue_______________________________________________,

]
)]
class ClassName { }

// 0.27.2
[SomeAttribute(

[
someValue_______________________________________________,
someValue_______________________________________________,
]
)]
class ClassName { }

```

Thanks go to @Rudomitori for reporting the bug.
### using static System.* usings not ordered before other static usings like using System.* ones [#1162](https://github.com/belav/csharpier/issues/1162)
Static usings were not following the rule that `System.*` should be sorted to the top.
```c#
// input & expected output
using static System;
using static System.Web;
using static AWord;
using static ZWord;

// 0.27.2
using static AWord;
using static System;
using static System.Web;
using static ZWord;
```

### Remove hash from version [#1144](https://github.com/belav/csharpier/issues/1144)
When `.net8` support was added, CSharpier started including a commit hash in the version number output. This was due to a [breaking change](https://github.com/dotnet/sdk/issues/34568) in the sdk.
```bash
> dotnet csharpier --version
0.27.2+b456544aad8957d0e2026afe1a37544bb74552ba
```

CSharpier no longer includes the commit hash
```bash
> dotnet csharpier --version
0.27.3
```

**Full Changelog**: https://github.com/belav/csharpier/compare/0.27.2...0.27.3
# 0.27.2
## What's Changed
### Orphan variable since 0.27.1 [#1153](https://github.com/belav/csharpier/issues/1153)
0.27.1 introduced the following formatting regression, resulting in short variables being orphaned on a line
Expand Down Expand Up @@ -2085,3 +2219,4 @@ Thanks go to @pingzing




1 change: 1 addition & 0 deletions CSharpier.sln
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.husky\task-runner.json = .husky\task-runner.json
Directory.Build.props = Directory.Build.props
Directory.Packages.props = Directory.Packages.props
Nuget\Build.props = Nuget\Build.props
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CSharpier.Benchmarks", "Src\CSharpier.Benchmarks\CSharpier.Benchmarks.csproj", "{A338903F-69AD-4950-B827-8EE75F98B620}"
Expand Down
3 changes: 2 additions & 1 deletion Nuget/Build.props
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<Project>
<PropertyGroup>
<Version>0.27.2</Version>
<Version>0.27.3</Version>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryUrl>https://github.com/belav/csharpier</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Description>CSharpier is an opinionated code formatter for c#.</Description>
<PackageIcon>logo.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
</PropertyGroup>
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)\README.md" Pack="true" PackagePath="\" />
Expand Down
3 changes: 3 additions & 0 deletions Src/Website/docs/Editors.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ Use the [official plugin](https://plugins.jetbrains.com/plugin/18243-csharpier)
It can be installed via the Plugins dialog.
### Neovim
Use [neoformat](https://github.com/sbdchd/neoformat)

### Emacs
Use [format-all](https://github.com/lassik/emacs-format-all-the-code)
Loading