T O P I C R E V I E W |
GreenMoose |
Posted - Jun 04 2007 : 09:38:27 AM typedef std::vector<std::wstring> AList; typedef std::map<int, List> AMap; <...> AMap oObj; <...> oObj;
It would be nice to have some feature that would me to from "oObj" see what type the typedefs are.. Like get a list when over oObj and then get something like
+ AMap oObj => - AMap oObj + std::map<int, List> oObj => - AMap oObj - std::map<int, List> oObj + std::map<int, std::vector<std::wstring>> oObj
Or simliar :) Now I usually mark the oObj => Press alt-G which finds the AMap oObj; => Press alt-G for AMap to find typedef std::map<int, List> => press Alt-G for List to find typedef std::vector<std::wstring> . Then I have to locate the place where I was placed originally (Ctrl-"-" helps here...)
Thanks. |
8 L A T E S T R E P L I E S (Newest First) |
feline |
Posted - Jun 06 2007 : 08:53:39 AM Yes, a "Show Type" option in the HCB makes a lot of sense. I have put in a feature request for this:
case=6956 |
GreenMoose |
Posted - Jun 06 2007 : 03:50:50 AM Nah the tooltip is probably bad idea (that's why I added a note about it as edit in my previous post). Regarding the expanding I'm not sure how VAView works today but as long as I am in a function using local variables it seems to do what I want (i.e. listing the variable type in the VAView with some sort of class view?). But with members it seems just to highlight the member? If one somehow could see the class of the member just like with local variables I would be a happy puppy. E.g. by pinning the VAView and then using [+] on members where one could expand the member and see what classes it has (and then expand the classes and so forth), or just by maybe dbl-clicking/ctrl-click-something/whatever the member and VAView will switch to the type of that member, but without changing editor context.
(I aggree that typedefs cause more grief than they are worth for complex types and I usually try to avoid them as much as I try to avoid macros)
** Edit: ***
Or actually, I am having this trouble: class MyClass; typedef boost::shared_ptr<MyClass> MyClassPtr; class MyClass { void Foo() {} };
Then in some file I use MyClassPtr e.g. "MyClassPtr pObj;", the trouble here is I can only, in VAView, see that type is "boost::shared_ptr<MyClass>" and then it lists all shared_ptr members (which is great). But I have no way, from the VAView, to go to the MyClass members. I must go to MyClassPtr typedef, and then hover over the MyClass to get VAView updated with the info I need. It would be greate to have this form of "go-to-type" within the VAView... |
feline |
Posted - Jun 05 2007 : 12:02:07 PM What happens when you have something like this extension of your original example:
typedef MY_INT int
#define MY_LONG long
#define MY_PAIR std::pair<MY_INT, MY_LONG>
typedef std::vector<std::wstring> MY_VECTOR;
typedef std::map<MY_PAIR, MY_VECTOR> AMap;
not nice, and I am quite sure we have users who have done far more complex things, with very good reasons. Just wait until they start throwing ## inside macro's to create class names at run time into the mix.
Personally I really dislike typedef's that hide the type from me, since I end up not knowing what I am manipulating, or how I should manipulate it. So I like this idea, but we need to think through how it might work in complex cases before I will put in a feature request. I want some idea of what we are getting into here.
Any form of hovering icon / menu you have to expand with the mouse, you need to compete with IDE tooltips (who goes on top?) and this is not keyboard friendly.
The bigger question / concern is what happens here, where you have a "branching" tree? What happens when you replace MY_VECTOR with std::vector? Suddenly the typedef's stop, you get a normal type, but with more typedef's inside of it? |
GreenMoose |
Posted - Jun 05 2007 : 09:55:46 AM Or actually, the VA View didn't help when standing on a typedeffed member, it just highlights the member variable in the VAView then.
You already have the "refactoring" drop-down icon, I think it would be nice with a sortof IDE-intellisense behavior like "Expand type" or similar, and for each level (type/macro whatever) there is a "+" sign which one can click to get to next level.
E.g.:
typedef int Foo; typedef Moo Foo; typedef std::pair<Foo, Moo> Bar; class MyClass { Bar mBar; } <class impl.> mBar;
If I here hover the mBar, I would see something like the regular tooltip and then the VA drop-down: ^ Expand symbol [mBar] so I click it then I get + Bar mBar <click +> ..+std::pair<Foo, Moo> Bar <click +> ....+std::pair<int, Foo> Bar <click +> ......+ std::pair<int, int> Bar
Wouldn't that be kinda' neat? :o)
Although I guess it isn't so neat when one should expand the template types (e.g. the pair above) or something like:
typedef std::map<std::wstring, int> Foo;
+ std::map<std::wstring, int> Foo ..+ [entire expanded crypted map template thingy]<std::basic_string<CharType[entire thingy here], int> Foo
** Edit on 2nd thought, I probably prefer the suggestion from sl@sh; "Maybe a little improvement to HCB would help? (i. e. show/switch to base type without switching editor context?)". Navigating to the typedefs without switching editor context would be great for this IMHO. |
feline |
Posted - Jun 05 2007 : 07:15:53 AM This is an interesting idea, but I am wondering how well it would work in practice. What about system items, like FALSE and TRUE? How far down do people really want to dig, and where should we try to show this information?
What VA View is doing works quite well, and makes sense. In your example the parameters to the std::map really complicate the issue, since you need to clearly distinguish between the display for std::map and any additional display for the parameters... |
sl@sh |
Posted - Jun 05 2007 : 03:33:13 AM Ah, you're right of course: when you point to the variable the tooltip only shows the variable definition - I was assuming pointing the mouse to the typedef, but of course you won't be able to when you're in the middle of the code, stupid me. . |
GreenMoose |
Posted - Jun 05 2007 : 02:07:13 AM Hrm my tooltip doesn't show the typedef, it only shows that oObj is of type "AMap".
The VA View helped alot though, guess that is the (and more) functionality I needed ... Thanks for the tip. |
sl@sh |
Posted - Jun 04 2007 : 12:33:10 PM The tooltip should already show the typedef declaration.
HCB (VA View) might also help with respect to nested declarations, although interacting tends to affect your editor context as well.
Maybe a little improvement to HCB would help? (i. e. show/switch to base type without switching editor context?)
|
|
|