Inproper behavior of Outermost parenthesis option under Indent each line relatively to in Visual Studio 2022 17.6.2

Patryk Stepien 0 Reputation points
2023-05-26T20:16:43.62+00:00

I am facing the issue with indentation with Visual Studio 2022 formatting code for second line with group of std::array elements inside of curly braces as below:

constexpr static std::array scalarDataTypes
   {
      uint0_t, uint8_t, uint16_t, uint32_t, uint64_t, sint0_t, sint8_t,
         sint16_t, sint32_t, sint64_t, boolean_t, float_t, double_t
   };

My goal is to get second line with group of std::array elements on the same indent level as in first line as on screenshot below:

constexpr static std::array scalarDataTypes
   {
      uint0_t, uint8_t, uint16_t, uint32_t, uint64_t, sint0_t, sint8_t,
      sint16_t, sint32_t, sint64_t, boolean_t, float_t, double_t
   };

From my understanding setting Outermost parenthesis under Indent each line relatively to (Tools -> Options -> Text Editor -> C/C++ -> Code Style -> Formatting -> Indentation) should solve this behavior, but it doesn't.

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,250 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,780 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Anna Xiu-MSFT 30,026 Reputation points Microsoft Vendor
    2023-05-29T10:23:17.4866667+00:00

    Hi @Patryk Stepien, 

    Welcome to Microsoft Q&A! 

    I tested on my side and was unable to find a setting to change the indentation behavior in C++.

    You can request a feature by selecting “Help” menu > Send Feedback > Suggest a Feature.  

    Update:

    I found it is different between VS2022 Community version 17.4.2 and version 17.6.2.

    In version 17.4.2, the indentation behaves as you expect.

    You can try to roll back to your VS2022 to the version 17.4.x if you need.

    Or you can report it to product team in Developer Community.

    Sincerely,

    Anna


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.