Author |
Topic |
|
znakeeye
Tomato Guru
379 Posts |
Posted - Sep 22 2007 : 05:27:42 AM
|
In my source code I find this:
MyFunction(&m_myClass);
m_myClass += 3;
// Sure this is ugly code, but it's just for demonstration purposes ;)
Now I want to go the class definition. This involves many steps: Place the cursor on "m_myClass", press Alt+G, then in the header file I have to move left until the cursor is above "CMyClass" and press Alt+G again.
Why not let Alt+Shift+G do this? A nice "Go to the type definition of this variable" feature. |
|
znakeeye
Tomato Guru
379 Posts |
Posted - Sep 22 2007 : 05:33:44 AM
|
Another solution would be to let Alt+G place the cursor over the variable type in the header-file. That way, you could press Alt+G twice to accomplish the above.
Case #? ;) |
|
|
sl@sh
Tomato Guru
Switzerland
204 Posts |
Posted - Sep 24 2007 : 04:14:42 AM
|
quote: Originally posted by znakeeye
... I have to move left until the cursor is above "CMyClass" and press Alt+G again.
Just press [Home] - that is, unless you are not in the habit of putting the class name on the first column of the line . In the end you have to press Alt+g;Home;Alt+g. Not that big an issue, but I see your point. Even more: I have been bugged by this behaviour myself!
It makes a lot of sense to have a means to jump from a symbol directly to the symbol's type's definition in just one step. You could of course define a macro for the above command sequence, but having it available ready to use would be a treat! |
|
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Sep 24 2007 : 1:03:33 PM
|
Have you tried showing VA View and then hovering the mouse over a variable?
I see the appeal, but I can also see the immediate problem:
typedef myType std::map<typedef_produced_type1, typedef_produced_type2>
// ...
myType foo; // I want to jump to typedef_produced_type1 |
zen is the art of being at one with the two'ness |
|
|
znakeeye
Tomato Guru
379 Posts |
Posted - Sep 24 2007 : 2:21:39 PM
|
That's not a problem. That's 1/2 issues that will not be solved with the above. 1/2 > 0/2 :) |
|
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Sep 28 2007 : 3:01:59 PM
|
I have put in a feature request for a command to jump to the type.
The point I was trying to make is that there are still "edge" cases where people are likely to want something more clever, but this should be helpful enough for now, if / when it is done.
case=9113 |
zen is the art of being at one with the two'ness |
Edited by - feline on Sep 28 2007 3:02:10 PM |
|
|
accord
Whole Tomato Software
United Kingdom
3287 Posts |
Posted - Sep 29 2007 : 12:46:38 PM
|
This new feature is a good idea. I hope it will solve the basic cases:
cMyClass test; <-- jump to cMyClass tRef <cMyClass> test; <-- jump to cMyClass cMyClass* GetSomething(); <-- jump to cMyClass
If there is an ambiguous case, VAX should display a listbox: std::map<typedef_produced_type1, typedef_produced_type2> test; <-- listbox with typedef_produced_type1 and typedef_produced_type2
In your typedef, VAX should go to the typedef's declaration, I think.
On function names without returning type, ALT+SHIFT+G should do nothing (or do beep)
I think this feature would be usefull, because I am jumping to variable's type frequently... |
Edited by - accord on Sep 29 2007 2:06:58 PM |
|
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Oct 02 2007 : 2:37:06 PM
|
In your second example why should VA jump to cMyClass? tRef is an equally valid choice to my mind, since in the general case who knows what the template class is doing that you might want to know about. |
zen is the art of being at one with the two'ness |
|
|
accord
Whole Tomato Software
United Kingdom
3287 Posts |
Posted - Oct 03 2007 : 4:57:00 PM
|
I think, most C++ user using a small number of templates: arrays, references, hash maps, lists, etc.
These are well known and well tested basic stuffs, like int or float
In edge cases the normal way still remains available to find the desired declaration. If in most of the time users want to see to type of the template, it will be disturbing seeing a disambiguation listbox every time.
For example I use my tRef template VERY often and most of the time I do not want to see the template itself.
Yes, the another solution is to show every time a disambiguation listbox, where more then 1 types are presents. |
Edited by - accord on Oct 03 2007 5:13:48 PM |
|
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Oct 04 2007 : 11:41:59 AM
|
This is where the whole question can start to get "messy". Personally my template usage falls into two camps:
a) standard template's, STL, etc, things that "just work" and that I have no interest in jumping to b) a template function / class I wrote myself to do something "clever", I am quite likely to be interested in these
However VA is not going to know which group a given template falls into. If the template type comes from a stable include directory then it is probably safe to ignore it, and assume you don't want to go there. However tRef is not a standard template class that I recognise
For me this is just an example of a whole group of edge cases.
What happens when using something more like:
#define MY_MAP(X) std::map<int, X>
Now I just made that up to illustrate a point, but I have the impression that different people are expecting different things to happen here. |
zen is the art of being at one with the two'ness |
|
|
|
Topic |
|