VS Code extension for C# / .NET projects that navigates directly to the MediatR handler of any Command, Query or Notification — just place the cursor on the class name and press Ctrl+Alt+H.
Works with IRequestHandler<TRequest>, IRequestHandler<TRequest, TResponse> and INotificationHandler<TNotification>.
Features
- Go to Handler — jump from any
Command or Query straight to its Handle method
- Notification support — also resolves
INotificationHandler<T> handlers
- Multiple handlers — when more than one handler is found, shows a Quick Pick to choose
- Works anywhere — cursor can be on a
Send(new MyQuery(...)) call, a variable type, a using statement, or the class definition itself
- No configuration needed — works out of the box with standard MediatR conventions
Usage
Place the cursor on any MediatR request class name and press:
| Shortcut |
Command |
Ctrl+Alt+H |
MediatR: Go to Handler |
The command is also available via the Command Palette (Ctrl+Shift+P).
Examples
From a Send call
// Cursor anywhere on "GetOrderByIdQuery" → Ctrl+Alt+H
var result = await _mediator.Send(new GetOrderByIdQuery { Id = id });
Navigates to:
public class GetOrderByIdQueryHandler : IRequestHandler<GetOrderByIdQuery, OrderDto>
{
public async Task<OrderDto> Handle(GetOrderByIdQuery request, CancellationToken cancellationToken)
{ // ← lands here
...
}
}
From a Command dispatch
await _mediator.Send(new CreateOrderCommand { ... });
// ^^^^^^^^^^^^^^^^^^
// Ctrl+Alt+H → CreateOrderCommandHandler.Handle(...)
From a Notification
await _mediator.Publish(new OrderCreatedEvent { ... });
// ^^^^^^^^^^^^^^^^^
// Ctrl+Alt+H → OrderCreatedEventHandler.Handle(...)
How it searches
The extension scans all .cs files in the workspace (excluding obj/ and bin/) for the pattern:
IRequestHandler<ClassName[,>]
INotificationHandler<ClassName[,>]
Once the handler class is found, it jumps directly to the Handle method signature.
License
MIT