T O P I C R E V I E W |
xentrax |
Posted - Dec 11 2015 : 07:58:33 AM Hello,
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
Reverse order: #include "pch.h"
#include <sdk/sdk2/h3.h> #include <sdk/sdk2/h2.h> #include <sdk/sdk2/h1.h>
<-- 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.
|
1 L A T E S T R E P L I E S (Newest First) |
accord |
Posted - Dec 11 2015 : 6:10:25 PM Interesting idea, thank you, I have put in a feature request for this:
case=93822
For now, are you aware of Sort Lines? VAssistX -> Tools -> Sort Selected Lines
It's not the same but something you may find useful.
http://docs.wholetomato.com/default.asp?W175 |
|
|