Author |
Topic |
|
Alek86
Junior Member
Canada
20 Posts |
Posted - Aug 12 2011 : 11:06:00 AM
|
It would be very convenient to have the feature of Find References Results filtering (or grouping, like in IDEA). Especially I would like to see the feature "show only functions, which use the current type (or it's ancestor) as a parameter"
for example, you have:
struct Human {
uint GetLegsCount() const;
}
but in a few places you need to know if the human has no legs one of good C++ approaches is to write a free function
bool HasNoLegs(const Human&);
just not to complicate the Human interface
but then it's quite hard to find all these functions in the find references results if the class Human is being used often
the filtering option could help a lot |
|
accord
Whole Tomato Software
United Kingdom
3287 Posts |
Posted - Aug 12 2011 : 12:35:07 PM
|
I think this might be a very special case and we try to avoid too much options in our dialogs to keep them simple. I see why would it be important for you but yet I think this is not a general case, but a specific need for a specific problem.
I would try using a regular expression for this problem, like :i :i\\(.@Human.@\\)
Replace the Human with the class you need. I tried this approach with a decent sized solution (hundreds of files) with a very general class name and it resulted very few false positives for me. Give it a try.
The approach obviously has some limitations, e.g. it won't work if the function returns a template types, because of the first :i<space> which scans for an identifier name, but you may be able to tune it a little bit. |
Edited by - accord on Aug 12 2011 12:40:08 PM |
|
|
Alek86
Junior Member
Canada
20 Posts |
Posted - Sep 13 2011 : 5:48:06 PM
|
OK, I'll try again ( sorry for persistence :) )
There is a "Herb Sutter interface principle":
For a class X, all functions, including free functions, that both (a) "mention" X, and (b) are "supplied with" X are logically part of X, because they form part of the interface of X.
( from http://www.gotw.ca/publications/mill08.htm )
so it would be quite good to have a function in VA, which would help C++ programmers, who use this principle, to see the whole "extended" interface of X.
For example, if a few (or many) programmers support 1 big project and 1 of them write a function:
void Beautify(std::string&);
all other developers could miss this change. If the same programmer could change std::string class and didn't use this interface principle, he could create a function:
void std::string::Beautify();
and all other programmers would see this function easily (when programmers need something from an object, the first thing they do is check if the function they need is in this class; it's quite easy to check, they just need to add point after the object and check the list of methods)
in a real situation (where the programmer can't change std::string) if there is the feature I proposed, the same programmers would just check the "extended" interface and find this void Beautify(std::string&) function quite easy.
P.S. the examples with Human and std::string are not very rare. I think when the VA developers write the app (if they write in C++), they use the same principle quite often
|
|
|
accord
Whole Tomato Software
United Kingdom
3287 Posts |
Posted - Sep 14 2011 : 11:04:01 AM
|
quote:
OK, I'll try again ( sorry for persistence :) )
No problem, this forum is to discuss matters :)
Anyway, what you are talking about is makes sense, and indeed it isn't a rare scenario as I first thought. Your example about the string and that you may not able to modify the main class are good arguments. Also the fact that if you write a "helper" function (that is not part of the main class) may not be easily noticeable for other programmers is a very practical observation. I have experienced all of the above problems myself...
I have put in a feature request to see what the developers make of it:
case=61242 |
|
|
Alek86
Junior Member
Canada
20 Posts |
Posted - Mar 20 2013 : 2:07:18 PM
|
hi again. Is there a way I can follow this feature request? :)
Or maybe it's declined already... |
|
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Mar 20 2013 : 2:43:34 PM
|
You cannot see the case's directly, but you can always ask what is happening. Unfortunately no progress has been made on this, but it is still in the list of features we are considering adding to VA at some point. We get a lot of feature requests, so working out which ones to add first is slightly tricky. |
zen is the art of being at one with the two'ness |
|
|
|
Topic |
|