2

I've been using Visual Studio 2022 for the last few months, and I want to have my C and C++ code formatted with the following style:

if (someCondition) { // Do something } else if (someOtherCodition) { // Do something else } else { // Otherwise } 

However, after entering the code with the above format, the IDE displays the code with the following format on reload:

if (someCondition) { // Do something } else if (someOtherCodition) { // Do something else } else { // Otherwise } 

which looks very untidy. How do I configure the IDE to keep the format that I enter? This is not really a programming question, but would appreciate some guidance. There must be an option that can be changed, but I can't find it.

1
  • I would use clang format and then you can customize the formatting to your hearts content Commented Jun 16, 2022 at 23:56

1 Answer 1

5

Reset/uncheck the option "Place 'else' on new line".

enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

Many thanks, it works, and saved me some time! There are some other options which I may want to change.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.