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
 Automatic #include insertion
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

znakeeye
Tomato Guru

379 Posts

Posted - Oct 05 2007 :  06:56:27 AM  Show Profile  Reply with Quote
This is simply brilliant, so I hope you include this feature in build 1562

Whenever you declare an instance of a class, function or global variable defined in "SomeHeader.h", you want it to be included. Why not automate this?

How about a VAX right-click menu item: "Add necessary include-statements for the current selection"
And/or a keyboard shortcut? E.g. Alt+I
Perhaps an extra option to perform all this silently in the background?

Some things to consider:
1) Multiple header-matches -> pop up a menu with all matching files.
2) Do not include full paths, if not necessary.
3) A.h includes B.h. If A.h is included, B.h is not needed.
4) Put the #include inside file.h instead of file.cpp, if need be.

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Oct 06 2007 :  12:34:19 PM  Show Profile  Reply with Quote
We are considering doing something like this:

case=226

zen is the art of being at one with the two'ness
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Oct 07 2007 :  06:04:16 AM  Show Profile  Reply with Quote
What about to underline (~~~) symbols which need include file with green. When I right click on an underlined symbol, a refactoring menu item should be occur, something like "Add necessary include file".

This solution has 2 advantage at least:
1. I will know if a symbol needs additional including without the need of compilation.
2. If will work automatically on copy-pasted code. Copying and pasting code to an another file is very common when I refactoring existing code base.

Certainly, this version can work for selections also.
(The red underline (~~~) is already VERY useful in refactoring! )

What do you think?

Edited by - accord on Oct 07 2007 06:45:05 AM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Oct 08 2007 :  3:15:44 PM  Show Profile  Reply with Quote
I like the idea, but I can also see a pile of edge cases, to do with conditional include statements, that are likely to cause problems. Specifically this relies on VA working out that the #include is not present, which is sometimes rather hard to determine.

We are working on a form of this feature in C# in the 1609 beta. I don't know if you ever use C# or not, but VA will suggest the missing namespace line while typing, and you can accept the suggestion, like any "normal" suggestion listbox to have the using statement added.

Of course this does not help with the copy / paste situation.

zen is the art of being at one with the two'ness
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Oct 09 2007 :  09:30:45 AM  Show Profile  Reply with Quote
I don't plan to use C#.

If someone do not use conditional include statements he/she can use this feature.

But you are considering doing something like this. (case=226)
Are you tring to resolve this problem also?
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Oct 10 2007 :  2:41:18 PM  Show Profile  Reply with Quote
As far as I know we are considering doing this for C++, it is just a little difficult

I referenced C# as an example of how this might work in C++

zen is the art of being at one with the two'ness
Go to Top of Page

support
Whole Tomato Software

5566 Posts

Posted - Jan 27 2009 :  10:28:22 PM  Show Profile  Reply with Quote
case=226 is implemented in build 1715
Hover over an unrecognized symbol and choose "Add include xxxx" from the refactoring context menu.


Whole Tomato Software, Inc.
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