Bug Report T1146599
Visible to All Users

Code Formatting - csharp_new_line_before_open_brace setting in the editorconfig file is not taken into account

created 2 years ago

Hello,

I have csharp_new_line_before_open_brace set to "none" in my .editorconfig file ("csharp_new_line_before_open_brace = none") , but CodeRush Code Cleanup is still putting all opening braces on new lines.

For example, this code:

C#
public class TypeCoercer { public static object ChangeType(object value, Type type) { TypeConverterAttribute typeConverterAttribute; } }

…incorrectly turns into:

C#
public class TypeCoercer { public static object ChangeType(object value, Type type) { TypeConverterAttribute typeConverterAttribute; } }

Visual Studio's built-in "Format Document" correctly keeps the opening braces on the same line. How can I make Code Cleanup respect the .editorconfig file settings? This is critical because one company/environment that I work with prefers it one way, and another company prefers it the other. I use .editorconfig files to make sure I follow the companies' preferences.

I also notice that CodeRush settings show the "Wrap open brace" as "Before" despite the .editorconfig (attached screenshot). It seems like this may be the reason it isn't respecting the config. Perhaps I need to uncheck all of those options? But then it really isn't obeying the .editorconfig.

Please advise…thank you,

Ryan

Comments (1)
PW PW
Przemyslaw Wlodarczak (DevExpress) 2 years ago

    Ryan,

    I reproduced this issue locally and we are working on a fix. Please bear with us.

    Answers approved by DevExpress Support

    created 2 years ago

    We have addressed the issue described in this ticket and will include a fix in our next maintenance update. Should you need to apply our fix prior to official release, you can request a hotfix here.

    Important Notes:

    • Hotfixes may be unavailable for Early Access/Beta builds or updates set for release within a week.
    • .NET only: in the NuGet Package Manager, use your personal NuGet feed and check the "Include prerelease" option to view the hotfix package in the "Updates" tab.
      Comments (3)
      PW PW
      Przemyslaw Wlodarczak (DevExpress) 2 years ago

        Ryan,

        Do you mind if we make this ticket public to include it into the list of fixed issues for our next CodeRush release?

          Sure, sounds good, especially if it helps others.

          PW PW
          Przemyslaw Wlodarczak (DevExpress) 2 years ago

            Thank you!

            Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

            Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.