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 addition of Includes, C++.
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

GennadiyKorol
Ketchup Master

Israel
54 Posts

Posted - Jul 15 2008 :  4:59:56 PM  Show Profile  Reply with Quote
Good time of the day everyone,

I don't know if this was already suggested, so I might be the monkey's uncle here, but I have not seen this implemented anywhere and I have been searching for it a lot lately.

When creating implementations for new classes we often have to add numerous include files defining classes we'll be using.

So the workflow of getting the algorithm right is often broken by a routinely procedure that looks like this:

Recall where the class/procedure/enum etc was defined.
Go to the top of the current file.
Type #include <something> / #include "Class.h"
Go back to where you were before.

I do not know why having the power of today's parsers we still have to manually manage the include files.
Wouldn't it be neat if VAX would allow for the following feature:


  • Click over the symbol (Can be class name, procedure, etc), pick "Add include directive"

  • Visual assist analyzes the context in which the symbol is used, checks where that symbol is defined and adds the correct (relative path) include file on the top.
    If the file is defined in current project, it'd use #include "", otherwise consider this to be library include and use #include <> instead.


  • If the symbol would be defined in numerous places, a pop up window with the list of files where the symbol is defined would show up to let the user pick the desired one.


    Becoming greedy, it would be awesome if VAX could check whether Class members are accessed in .h files and suggest to make a forward declaration if the symbol is used only via a reference or a pointer. Would be really handy for forward declarations in include files.


    All in all, I do not know why we won't let the editor to automagically manage our includes as we work on the source files. To me, it should automatically add includes for the symbols not yet defined, and remove includes for symbols not used in the current source file, while I type, or before the project is compiled. This potentially could lead to a lot of redundant includes thanks to the nature of C++, but I trust there should be a way to work it out.



    Right now I have modified the VB script I found on the net that does what I want, based on Visual Studios knowledge of where the symbol is defined. It still won't work if I would try using in on the symbol which the editor have not yet indexed. This happens a lot when you work with large API's, where you would exactly love the auto create include directive feature...

    So I am sure many would love the proper implementation of this in VAX, using its knowledge about symbols.



    Looking forward to your opinions,
    Gennadiy

    Correctness might be a theoretical concept but incorrectness has practical implications.

    Edited by - GennadiyKorol on Jul 15 2008 5:05:17 PM

    feline
    Whole Tomato Software

    United Kingdom
    18751 Posts

    Posted - Jul 16 2008 :  1:42:58 PM  Show Profile  Reply with Quote
    This is something we are considering doing, but it is a hard problem to solve in general:

    case=226

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

    GennadiyKorol
    Ketchup Master

    Israel
    54 Posts

    Posted - Jul 16 2008 :  2:18:13 PM  Show Profile  Reply with Quote
    Great to hear that!

    Could you please tell me where can I check up the case, having its number?

    Correctness might be a theoretical concept but incorrectness has practical implications.
    Go to Top of Page

    feline
    Whole Tomato Software

    United Kingdom
    18751 Posts

    Posted - Jul 17 2008 :  10:39:24 AM  Show Profile  Reply with Quote
    You cannot check up on the cases directly, but this thread should be updated when this is done.

    I do not have any estimate on when this might be done, since it is not a simple thing to do.

    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:25:23 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

    GennadiyKorol
    Ketchup Master

    Israel
    54 Posts

    Posted - Jan 29 2009 :  4:57:16 PM  Show Profile  Reply with Quote
    This feature seems to be rather experimental as it does not allow me (the menu item is dimmed) to add include for unrecognized symbols in most of the cases.

    For instance:

    std::vector v;

    Will not allow you to add "vector" include to your current file.

    Also the includes are added using windows convention using "\\" delimiter which is not a cross platform way to handle the include paths.

    Also the feature does not differentiate between static (library) and dynamic (project files) includes.

    That is it always adds

    "include.h"

    Even if the include.h is a library include in which case it should use:

    <include.h>


    But I am very glad you are bringing this feature into VAX, Kudos!

    Correctness might be a theoretical concept but incorrectness has practical implications.
    Go to Top of Page

    feline
    Whole Tomato Software

    United Kingdom
    18751 Posts

    Posted - Jan 30 2009 :  11:48:43 AM  Show Profile  Reply with Quote
    We are looking to have VA use the "correct" delimiter, it will use the one that is currently being used in the file, rather than always using "\\":

    case=23341

    Something is going on with std::vector, but I am getting mixed results. Sometimes the command is not offered, as you say, and sometimes the command is offered, and it works correctly:

    case=23430

    Can you give an example for always getting #include "" ? When this command works on std::vector I am getting the line:

    #include <vector>

    which is what I am expecting.

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

    GennadiyKorol
    Ketchup Master

    Israel
    54 Posts

    Posted - Jan 30 2009 :  12:11:12 PM  Show Profile  Reply with Quote
    When my project is using some libraries that are not located in the project source tree, I am adding those using the "Additional Include Directories" option in the C++ compiler project tab.

    Say I am using library called Bananas that is located in C:/Dev/Libs/Bananas/

    I am going to add C:/Dev/Libs/Bananas/include to the "Additional Include Directories".

    Now in my code I will be using the library by typing:

    #include <bananas/banana.h>

    But in this case VAX will always add

    #include "bananas\\banana.h"

    The suggestion is to make VAX differentiate between the stable and non-stable includes.


    Correctness might be a theoretical concept but incorrectness has practical implications.

    Edited by - GennadiyKorol on Jan 30 2009 12:12:58 PM
    Go to Top of Page

    sean
    Whole Tomato Software

    USA
    2817 Posts

    Posted - Jan 30 2009 :  3:57:04 PM  Show Profile  Reply with Quote
    You mentioned stable and non-stable includes. Is the bananas/include directory listed in the "Stable include files" list (VA Options | Projects | C/C++ Directories)?
    Go to Top of Page

    GennadiyKorol
    Ketchup Master

    Israel
    54 Posts

    Posted - Jan 30 2009 :  6:11:08 PM  Show Profile  Reply with Quote
    Nope, these are not platform-sdk kind of includes, but just some other library includes.

    VAX parses those includes so it does search the "Additional Include Directories". At the same time it could mark the files from those directories as "stable".

    Correctness might be a theoretical concept but incorrectness has practical implications.
    Go to Top of Page

    sean
    Whole Tomato Software

    USA
    2817 Posts

    Posted - Jan 30 2009 :  6:54:42 PM  Show Profile  Reply with Quote
    That might make sense in that particular solution, but I think in general, "additional include directories" should not be treated that way. For example a solution that contains multiple dlls will use additional include directories to include headers among the different projects.
    Go to Top of Page

    GennadiyKorol
    Ketchup Master

    Israel
    54 Posts

    Posted - Jan 30 2009 :  7:32:54 PM  Show Profile  Reply with Quote
    That's true, even though one might add additional dll projects as references to their VS project in that case, saving adding the include/lib paths.

    Can you add additional folders to the VAX "stable includes" list?

    Correctness might be a theoretical concept but incorrectness has practical implications.
    Go to Top of Page

    sean
    Whole Tomato Software

    USA
    2817 Posts

    Posted - Jan 30 2009 :  9:19:59 PM  Show Profile  Reply with Quote
    By default, VA just mirrors your VC++ include directories. So if you add more directories to the Tools | Options | Projects and Solutions | VC++ Directories | Win32 Include files, VA will pick those up.

    If you don't want to change the VC++ directories, but do want to VA to see a different list, then in VA Options | Projects | C/C++ Directories, change platform from Win32 to Custom. Then you can modify the stable includes list.
    Go to Top of Page

    support
    Whole Tomato Software

    5566 Posts

    Posted - Mar 30 2009 :  08:41:37 AM  Show Profile  Reply with Quote
    case=23341 is implemented in build 1721

    Whole Tomato Software, Inc.
    Go to Top of Page

    sean
    Whole Tomato Software

    USA
    2817 Posts

    Posted - May 01 2009 :  8:46:28 PM  Show Profile  Reply with Quote
    case=23430 is fixed in build 1722.
    Go to Top of Page

    GennadiyKorol
    Ketchup Master

    Israel
    54 Posts

    Posted - Jul 04 2009 :  11:53:35 AM  Show Profile  Reply with Quote
    I have noticed that the include paths that are added are always using the "to lower case" convention.

    That is if my class Banana is defined in the file Banana.h

    the include will look like this:

    #include "banana.h"

    instead of

    #include "Banana.h"

    which is quite confusing and goes against some conventions.
    Do you think it would be hard to use the actual file name taking its case into consideration?

    Correctness might be a theoretical concept but incorrectness has practical implications.
    Go to Top of Page

    feline
    Whole Tomato Software

    United Kingdom
    18751 Posts

    Posted - Jul 04 2009 :  1:31:16 PM  Show Profile  Reply with Quote
    Which IDE and version of VA are you using?

    I have just tried this here with a mixed case .h file, and VA added:

    #include "Test_Alt_G_MixedCase.h"

    which is the correct case for this header file name. This is VS2005 with VA 1727.

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

    GennadiyKorol
    Ketchup Master

    Israel
    54 Posts

    Posted - Jul 04 2009 :  5:13:28 PM  Show Profile  Reply with Quote
    1727 here, I noticed it's not the case with each and every file. The file has an ordinary camel case name without any special characters.

    Correctness might be a theoretical concept but incorrectness has practical implications.
    Go to Top of Page

    feline
    Whole Tomato Software

    United Kingdom
    18751 Posts

    Posted - Jul 06 2009 :  1:19:48 PM  Show Profile  Reply with Quote
    Does it seem to matter how you trigger the Add Include command? If you delete the include line / undo the command, and re-try the command do you get the correct case, or do you still see the problem?

    Can you post the full path of one of these problem files?
    Is it located on the local hard drive or somewhere else? A network drive? A mapped drive letter? A junction point of some form?

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

    sean
    Whole Tomato Software

    USA
    2817 Posts

    Posted - Jul 06 2009 :  9:41:44 PM  Show Profile  Reply with Quote
    We recently fixed a bug that had similar symptoms. case=24588
    The fix will be in the next release cycle.
    Go to Top of Page

    support
    Whole Tomato Software

    5566 Posts

    Posted - Aug 22 2009 :  7:14:50 PM  Show Profile  Reply with Quote
    case=24588 is fixed in build 1731

    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