0

I've written a lot of functions without paying attention to their order and it has gotten kind of messy.

I want to make my code more readable by having the order of functions in my .cpp files match the order in the .h files. Is there a way to do this automatically in Visual Studio 2015 or do I have to do it manually?

What other options are there to automatically format my code to make it more readable in Visual Studio 2015?

e_lektro
  • 21
  • 4
  • Do you know how to do the opposite? http://stackoverflow.com/questions/41582286 – javaLover Jan 11 '17 at 07:43
  • Does this answer your question? [How can I sort method implementations according to their declaration order](https://stackoverflow.com/questions/9260500/how-can-i-sort-method-implementations-according-to-their-declaration-order) – mrts Apr 23 '21 at 12:22

1 Answers1

1

There isn't a built-in feature to do this. However you can collapse all of your implementations using Ctrl+M then Ctrl+O to make it easier to manipulate them. Ctrl+M then Ctrl+P disabled outlining after your done.

For the second part of your question, press Ctrl+K then Ctrl+F to automatically format any highlighted code. Ctrl+K then Ctrl+D automatically formats the entire document. The formatting rules are controlled in Tools->Options...->Text Editor->C/C++.

Other useful shortcuts can be found in Edit->Advanced or Edit->Outlining.

François Andrieux
  • 28,148
  • 6
  • 56
  • 87