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.

Developer technologies | C++
Developer technologies | Visual Studio | Other
{count} votes

1 answer

Sort by: Most helpful
  1. Anna Xiu-MSFT 31,056 Reputation points Microsoft External Staff
    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.