This a proposal to make "Add Include" for C++ smarter.
I.e. make it insert the line at the most appropriate location, not at the end. It may need some setting due to existense of "reverse" (reliable) and more popular "normal" approaches to C++ header inclusion order.
For instance, for a such sample file Classic order:
#include "pch.h" #include <sdk/utils.h>
#include <sdk/sdk1/h1.h> #include <sdk/sdk1/h2.h> #include <sdk/sdk1/h3.h> <-- Expected location for some sdk1 functionality
#include <sdk/sdk2/h1.h> #include <sdk/sdk2/h2.h> #include <sdk/sdk2/h3.h> <-- Currently implemented location
<-- Expected location for some sdk1 functionality #include <sdk/sdk1/h3.h> #include <sdk/sdk1/h2.h> #include <sdk/sdk1/h1.h>
#include <sdk/utils.h> <-- Currently implemented location
Forgeting conditiona compilation troubles, the algorithm can be simple enough: For classic order: Start looking at full paths of every included file from bottom to top. Should the parent dir file being added matches parent dir of some file, just insert new line after that found line. Unless the found header is a pair file of the currently opened cpp.
For reverse order: search from the top and insert before.
If I missing some registry setting, please point me in the correct direction.