diff --git a/CHANGELOG.md b/CHANGELOG.md index b9d4e19ba..07e25ba72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 @@ -2085,3 +2219,4 @@ Thanks go to @pingzing + diff --git a/CSharpier.sln b/CSharpier.sln index 42d01e219..eb9d3cf27 100644 --- a/CSharpier.sln +++ b/CSharpier.sln @@ -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}" diff --git a/Nuget/Build.props b/Nuget/Build.props index 6303769eb..b893d4f57 100644 --- a/Nuget/Build.props +++ b/Nuget/Build.props @@ -1,12 +1,13 @@ - 0.27.2 + 0.27.3 MIT https://github.com/belav/csharpier git CSharpier is an opinionated code formatter for c#. logo.png README.md + false diff --git a/Src/Website/docs/Editors.md b/Src/Website/docs/Editors.md index 70b4ba282..71f0b4ed2 100644 --- a/Src/Website/docs/Editors.md +++ b/Src/Website/docs/Editors.md @@ -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)