"Go To -> Message Handlers" feature in Resharper/Rider
Hello
I'm working on the project with message driven architecture in C#. It means, there are a lot of classes that describe message and handler types. They are decoupled via something like the following interface:
public interface IMessagePublisher
{
Task Publish(IMessage message);
}
The message handler:
public interface IHandle<T> where T : IMessage
{
Task On(T message);
}
The message interface:
public interface IMessage
{
}
Problem
Currently, it is hard to navigate to a message handler from the place where the message is published. And vise versa, hard to navigate to the place where the message is published from the handler.
Actual approach
So to find the handler I have to:
- put cursor to a message and go to message type (Go To > Declaration AKA Ctrl+B)
await _messagePublisher.Publish(new DeliveryCreated());
- jump from constructor to class name (Ctrl+[)
- hit Find Usages AKA Alt+F7
The result contains handlers, however there are also other usages which I don't need. So even actual approach is not what I want.
Expected approach
- put cursor to the message and hit Go To > Message Handlers
The result must list handlers only, basically all methods having the message type as first (or single) argument. For me, "Go To -> Message Handlers" and "Go To -> Message Publisher" feature will be super helpful and improve my productivity while reading source code.
Workaround
As workaround, I'm using text search (Ctrl+Shift+F) and type for instance "DeliveryCreated " (with space at the end) so Rider will show me only handler methods.
The same problem finding publisher from handler.
Does Resharper/Rider already have something implemented? Is it possible to implement as a plugin and where to look into?
Reddit discussion: https://www.reddit.com/r/dotnet/comments/dsdl6h/how_do_you_search_for_message_handlers_in_your_ide/
Please sign in to leave a comment.
Hello Vladimir,
Thank you for the feedback. I have created a corresponding request: RSRP-476903, please upvote and watch for monitoring the status.
Vladimir, thank you very much for such detailed request. I have developed a prototype of this feature. Your feedback in RSRP-476903 will be highly appreciated.