improper indention for c++ lambda in visual studio when auto formatting code

孟轩 郝 11 Reputation points
2023-01-16T07:36:40.5733333+00:00

I have a function "func" which takes another function as its parameter.

If I define a function with more than one line using lambda expression when calling "func", the auto formatting (ctrl+k,ctrl+d) seems to get confused.

This is what I think the supposed format:

supposed format

And this is the result using auto format (ctrl+k,ctrl+d):

auto formatting

The alignment of the line "int b=1;" and "return a+b" gets weird.

I'm wondering if this a buf of visual studio or it has something to do with my settings.

Thanks.

Developer technologies C++
{count} vote

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.