Question or feature suggestion: Jump to event listener
Hi everyone,
I often find myself looking at code where I invoke a C# event and want to check where it goes, meaning to the methods that have been attached to the event. I found two ways to do that:
A series of “go to Declaration or Usages” which leads me to the event declaration, the lines where a method is attached to the event and then, after a click on the method name and another “go to Declaration or Usages”, the method, or
a combination of “find usages” and the above, where the “find usages” dialogue leads me directly to the places where listeners are attached but it is a rather mouse clicky navigation so I tend to fire a couple “go to Declaration or Usages” instead because that's a no-menu hotkey.
Did I overlook something or is there nothing faster? I'd love to have a menu in the style of “Declaration or Usages” but it shows me the listeners right from the event symbol so I don't even need to go to the event declaration.
Thanks and have a nice week.
Please sign in to leave a comment.
Not sure if I understand your question correctly, the “Show Usages” action has corresponding shortcut, you don't need to use mouse to invoke the action. Or you can search the action in Context Actions (Alt + Enter) to invoke the action.
Regarding the feature request here:
If you have mutiple subscribers on the same event, use “Show Usages” is a more reliabe choice here.
Hey, thanks for your answer. I'm happy to explain again what I was looking for.
Say I have this class:
And then somewhere else:
Now, I want to get from point A to point B as fast as possible. Ideally I'd have a list similar to the results of “Find usages” - a “who is listening to this invoke”. The problem is that I cannot use a single “Find usages”. When I call it on the event in the DoSomething() method, it leads me to Init(), not to Cleanup(). Therefore, I have to use “Find usages” a second time.
I can see this makes perfect sense if there are several points where listeners are attached. My issue is that I have to leave the code window twice because I also can't get the required results from a context action.
I realize this is a small issue, yet for me it's one of the last things where I'm not working as fast as Rider usually allows me too. Thanks for reading. :)