Type used as generic parameter not showing up in "Find Usage"


"Find usages" here means either Shift+Alt+F12 or "Navigate from here->Usage":

public class Foo<T>  { }
public class Reffed {}
public class Bar
void UsingReffed()
//Find usages on Reffed here finds the other reference
var obj = new Foo<Reffed>();

void UsingReffed2()
//Find usages on Reffed here displays "This is the only usage"
var obj = new Reffed();

Bug? And if so, is it fixed in 5?

Comment actions Permalink

What you are searching for is constructor, not type itself. I agree this
looks like usability problem.

Ilya Ryzhenkov

JetBrains, Inc
"Develop with pleasure!"

IR> "Find usages" here means either Shift+Alt0F12 or "Navigate from
IR> here->Usage":
IR> public class Foo http://www.jetbrains.net/devnet/message/5261475#5261475

Comment actions Permalink

Ah I see.
But is there a way I can "simulate" the behavior I want?
I can't use "go to type declaration" and then "find usages" since it isn't a variable I am querying.
(my problem really is I want to find usages for type "MyException" when having the code "throw new MyException", i.e. verify it is catched in a unit test somewhere).

I can't find a way to do it as it is now, when I use "Go to declaration" I end up with the cursor at the constructor.
I must then manually browse to the class type containing this constructor to place cursor on it.
After that I can finally use "find usage" properly.

Maybe there should be a shortcut for
1) Find usages for type (i.e. does what I want in this case)
2) Go to type (even for constructors) (i.e. does what I want with 1 additional keystroke)



Please sign in to leave a comment.