Author |
Topic  |
|
e1e0n
New Member

4 Posts |
Posted - May 21 2008 : 3:32:27 PM
|
When I type complete varible declaration or otherwise use something from *.h file (ie, compiler will need class declaration or anything else which could be detected by VA) VA could include this file
ie:
#include "locatedIncludeFolder/MyCoolControl.h"
class A { ... private:
MyCoolControl m_MyCoolControl; }
I type this: MyCoolControl m_MyCoolControl; VA inserts this: #include "locatedIncludeFolder/MyCoolControl.h"
is it possible?
Thanks, Leo
|
|
accord
Whole Tomato Software
    
United Kingdom
3287 Posts |
Posted - May 21 2008 : 5:34:36 PM
|
We are looking into a feature to suggest missing #include statements, but even that "simple" operation can be quite tricky in C++
case=226
There are some tricky template and macro code out there, so implementing such a feature is not as obvious as it may seems at first sight. |
Edited by - accord on May 21 2008 5:54:57 PM |
 |
|
Dans
Senior Member
  
Ukraine
45 Posts |
Posted - May 22 2008 : 08:59:25 AM
|
I think this thing should have more interactive input.
When we add include: 1. We have "unknown identifier" error 2. We know that this include should be used
What expected: 1. Place carret on unknown identifier, press shortcut - VA suggests headers that contain this identifier
2. Place carret in empty space, press same shortcut - VA suggests list of availaible files that can be included (Project Include folders, VS Include folders, etc). It should be similar to "Open File in Workspace"
When user selects needful file you should search for last #include directive in file and insert #include keyword with selected header (when it's first just insert as first line). Current line position sould not be changed
TIA |
 |
|
feline
Whole Tomato Software
    
United Kingdom
19179 Posts |
Posted - May 22 2008 : 10:08:47 AM
|
VA suggesting possible header files for the symbol, this makes sense and may be the approach we end up taking.
The second idea, of sitting in some empty space, what is the advantage here? If you type a #include "" or #include <> line VA will already produce a listbox that you can filter, listing header files that are suitable.
The placing of the #include line, this is not automatically straight forward, what happens when #include lines are wrapped in #ifdef statements? What happens when the last #include line in the file is at line 500, since it is half way down the file, and there are a load of functions above it?
We will have to do something half sensible, but there are always edge cases to consider. |
zen is the art of being at one with the two'ness |
 |
|
Dans
Senior Member
  
Ukraine
45 Posts |
Posted - May 23 2008 : 08:26:18 AM
|
quote: VA suggesting possible header files for the symbol, this makes sense and may be the approach we end up taking.
It will be very useful. But not always you can suggest best file. For example with boost - for using boost::mutex you need to include <boost/thread/mutex.hpp> but there is more common include <boost/thread.hpp> It should be handled and suggested both includes.
quote:
The second idea, of sitting in some empty space, what is the advantage here? If you type a #include "" or #include <> line VA will already produce a listbox that you can filter, listing header files that are suitable.
I suggested this because, usually, i don't want to leave method that i currently changes. It just extension of suggesting include for "unknown identifier" but without filtering. IOW it's "nice to have" thing. Also i will use it to check that my project contain all needful or contain obsolete include directories 
quote:
The placing of the #include line, this is not automatically straight forward, what happens when #include lines are wrapped in #ifdef statements? What happens when the last #include line in the file is at line 500, since it is half way down the file, and there are a load of functions above it?
We will have to do something half sensible, but there are always edge cases to consider.
Don't try to cover all exceptions, suggested algorithm works in 90% cases. If i know that my file contain sophisticated include scheme - i'll never use "smart" tool . Also we can increase algorithm strength: last #include up to current line, do not use #include that in method, etc.
|
 |
|
|
Topic  |
|
|
|