Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 Position of inserion for Add Include
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

xentrax
Starting Member

Russia
1 Posts

Posted - Dec 11 2015 :  07:58:33 AM  Show Profile  Reply with Quote
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.

Edited by - xentrax on Dec 11 2015 08:02:02 AM

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Dec 11 2015 :  6:10:25 PM  Show Profile  Reply with Quote
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
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000