-
Notifications
You must be signed in to change notification settings - Fork 0
ResultR.VSCodeToolkit
Supercharge your ResultR development workflow with instant navigation from requests to handlers and one-click scaffolding of new request/handler pairs. The ResultR VS Code Toolkit is the essential companion extension for developers using the ResultR library.
- Open VS Code
- Go to Extensions (Ctrl+Shift+X)
- Search for "ResultR"
- Click Install
- Download the
.vsixfile from the releases page - Install via command line:
code --install-extension ResultR.VSCodeToolkit.x.x.x.vsix
The extension is also available on Open VSX for VS Code forks like VSCodium.
- VS Code 1.85.0 or later
- Projects using the ResultR library
Instantly navigate from any IRequest or IRequest<T> type to its corresponding handler implementation.
- Place your cursor on any
IRequesttype (variable, parameter, or class definition) - Use one of these methods:
-
Keyboard: Press
Ctrl+R, Ctrl+H -
Command Palette:
ResultR: Go to Handler - Context Menu: Right-click and select "Go to Handler..."
-
Keyboard: Press
The toolkit searches your entire workspace for handlers that implement:
-
IRequestHandler<TRequest>forIRequesttypes -
IRequestHandler<TRequest, TResponse>forIRequest<TResponse>types
It works across projects, so your handler can be in a completely different folder or project.
// Place cursor on HelloWorldRequest and press Ctrl+R, Ctrl+H
var request = new HelloWorldRequest();
var result = await dispatcher.Dispatch(request);The toolkit will navigate to:
public class HelloWorldHandler : IRequestHandler<HelloWorldRequest>
{
public async ValueTask<Result> HandleAsync(HelloWorldRequest request, CancellationToken cancellationToken)
{
// Handler implementation
}
}Quickly create new request and handler classes with proper namespaces and structure.
- In the Explorer, right-click on a folder
- Select "ResultR: New Request/Handler"
- Enter the request name (e.g., "HelloWorld")
- Press Enter
Or use the Command Palette:
- Press
Ctrl+Shift+P - Type "ResultR: New Request/Handler"
- Select the target folder
- Enter the request name
The toolkit creates a single .cs file containing both the request and handler:
using ResultR;
namespace HelloWorldApp;
public record HelloWorldRequest() : IRequest;
public class HelloWorldHandler : IRequestHandler<HelloWorldRequest>
{
public async ValueTask<Result> HandleAsync(HelloWorldRequest request, CancellationToken cancellationToken)
{
throw new NotImplementedException();
}
}The toolkit automatically:
- Detects your project's namespace conventions from existing files
- Uses file-scoped namespaces if your project uses them
- Uses block-scoped namespaces if that's your convention
- Derives the namespace from the folder structure and project name
| Action | Shortcut |
|---|---|
| Go to Handler | Ctrl+R, Ctrl+H |
| Command | Description |
|---|---|
ResultR: Go to Handler |
Navigate to the handler for the request under cursor |
ResultR: New Request/Handler |
Create a new request/handler pair |
This can happen if:
- The handler doesn't exist yet
- The handler is in a folder excluded from search
- The handler doesn't implement the correct interface
Ensure your handler implements the exact interface for your request type. For example:
-
GetUserRequest : IRequest<User>should have a handler implementingIRequestHandler<GetUserRequest, User>
- Make sure you have a folder selected or right-clicked
- Ensure the workspace contains C# files for namespace detection
The extension works out of the box with sensible defaults. It automatically excludes common folders like bin, obj, and node_modules from searches.
Built with ❤️ for the C# / DotNet community.