Bug Report T736485
Visible to All Users

Formatting - Code formatting does not take into account settings overridden by an .editorconfig file

created 6 years ago

Example:

My C# intentation settings in VS is configured as tabs.
An .editorconfig file in my current solution overrides this to indent using 4 spaces.

The built-in VS command Edit -> Advanced -> Format Document respects the overridden settings from .editorconfig.

However, applying CodeRush Document Formatting feature (either as part of a Code Cleanup command or executed by itself) only seems to look at the VS-configured settings, and does not seem to take into account that they are being overridden by .editorconfig.

This leads to several problems:

  1. Formatting rules defined and enforced on a team are violated by CodeRush
  2. The built-in formatting and CodeRush formatting produce different results even on the same solution

Since the .editorconfig file is Visual Studio's built-in standard mechanism for overriding format settings per project, I expect CodeRush to honor those settings.

Show previous comments (3)
DevExpress Support Team 5 years ago

    Hi Daniel and Pontus,

    We have found a way to support .editorconfig file settings in the CodeRush formatting engine. We have implemented this functionality and it is included in the 19.2.9 build. This build is available for download in the Visual Studio Marketplace and Download Manager. Please check whether CodeRush formats code according to settings in your .editorconfig file.

    We are looking forward to hearing from you.

    DR DR
    Daniel Rosenberg 5 years ago

      That’s really great news! Is there any documentation on which .editorconfig settings CodeRush now respects, and which ones it does not?

      DevExpress Support Team 5 years ago

        Hi Daniel,

        Now, CodeRush reads only those settings from the .editorconfig file that don't have counterparts in our formatting engine (namely the "Use Tabs or Spaces" and indent size options). In previous versions, CodeRush always read these settings from Visual Studio and did not consider the .editorconfig file.

        Currently, our documentation doesn't contain this information. Thank you for pointing this out. We will update the documentation accordingly.

        Answers approved by DevExpress Support

        created 4 years ago

        CodeRush v20.2.7 now supports Visual Studio's format settings defined in the EditorConfig file.
        You can find more information on the EditorConfig file support at the following links:
        EditorConfig Support
        Code Formatting

        Also, let me note that in CodeRush v20.2.4, we already supported the EditorConfig file for the Naming Conventions feature:
        Visual Studio's Options and Settings from the EditorConfig File
        Naming Conventions

          Comments (2)
          DR DR
          Daniel Rosenberg 4 years ago

            Great, thanks for the update Dmitry!

            DevExpress Support Team 4 years ago

              Hi Daniel,
              You are welcome.

              created 5 years ago

              We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.

              Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.

                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.