Skip to content

0.25.0

Compare
Choose a tag to compare
@belav belav released this 25 Jun 15:38
· 258 commits to main since this release
21bc71d

Breaking Changes

Improve if directive formatting #404

The preprocessorSymbolSets configuration option is no longer supported.
CSharpier can now parse and format the full range of #if preprocessor statements so it is no longer required.

// 0.24.2 - supported some basic versions of #if
#if DEBUG
// some code 
#endif

// 0.25.0 - supports the full range of #if including nested statements
// would require the use of the preprocessorSymbolSets configuration option previously 
#if (DEBUG && !NET48) || MONO
// some code
#if NET6_0
// some other code
#endif 
#endif

What's Changed

Sort Modifiers #725

CSharpier will now sort modifiers according to the defaults for IDE0036

// input
public override async Task Method1() { } 
async public override Task Method2() { }

// output
public override async Task Method1() { } 
public override async Task Method2() { }

Thanks go to @glmnet for the contribution

Support c# 12 features #883

CSharpier now supports formatting
Primary Constructors,
Alias any typ, and
Default lambda parameters

Support for log levels #875

CSharpier now supports --loglevel with the CLI and CSharpier_LogLevel for MSBuild. This changes the level of logging output. Valid options are:

  • None
  • Error
  • Warning
  • Information (default)
  • Debug

Thanks go to @samtrion for the suggestion

CSharpier removes blank line before unsafe block #917

CSharpier was not honoring lines that appeared before unsafe

// input
var x = 1;

unsafe
{
    // should retain empty line
}

// 0.24.2
var x = 1;
unsafe
{
    // should retain empty line
}

// 0.25.0
var x = 1;

unsafe
{
    // should retain empty line
}

Thanks go to @fgimian for reporting the bug

Adding ability to bypass CSharpier when using CSharpier.MsBuild #914

In some instances it is desirable to completely bypass CSharpier.MsBuild, this can now be done with the CSharpier_Bypass property.

dotnet publish -c release -o /app --no-restore /p:CSharpier_Bypass=true

Thanks go to @OneCyrus for the suggestion

Strong Name Sign Assemblies #911

CSharpier is now strong name signed so that it can be used in packages that are strong name signed.

Thanks go to @TwentyFourMinutes for the suggestions and to @goelhardik for strong name signing Ignore

Don't format files in obj folders #910

CSharpier will no longer format cs files that are in an obj folder.

CSharpier.MsBuild runs once for each framework, can it be more efficient. #900

When CSharpier.MsBuild was in a csproj that had multiple target frameworks, it would run once for each target framework. It will now run just a single time.

CSharpier.MsBuild returns exit code 1 when ManagePackageVersionsCentrally is set to true #898

CSharpier.MsBuild was not running correctly when used in a project that had centrally managed package version.

Thanks go to @adc-cjewett for reporting the bug

Multiline comments always indented with spaces when formatting with tabs #891

With useTabs: true, CSharpier was formatting multiline comments with a space instead of a tab.

// input
public class Foo
{
	/**
	 * comment
	 */
	public class Bar { }
}

// 0.24.1
public class Foo
{
 /**
  * comment
  */
	public class Bar { }
}

// 0.25.0
public class Foo
{
	/**
	 * comment
	 */
	public class Bar { }
}

Thanks go to @MonstraG for reporting the bug.

File scoped namespaces should be followed by a blank line #861

CSharpier now adds an empty line after file scoped namespaces if there is not already one

// input
namespace Namespace;
using System;

// 0.25.0
namespace Namespace;

using System;

Full Changelog: 0.24.2...0.25.0