|
1 |
| -using System; |
2 |
| -using System.Threading; |
| 1 | +using System.Threading; |
3 | 2 | using System.Threading.Tasks;
|
4 | 3 | using MediatR;
|
5 | 4 | using OmniSharp.Extensions.JsonRpc;
|
| 5 | +using OmniSharp.Extensions.JsonRpc.Generation; |
6 | 6 |
|
7 | 7 | namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events
|
8 | 8 | {
|
9 |
| - |
10 | 9 | [Parallel, Method(EventNames.Capabilities, Direction.ServerToClient)]
|
| 10 | + [GenerateRequestMethods, GenerateHandlerMethods] |
11 | 11 | public interface ICapabilitiesHandler : IJsonRpcNotificationHandler<CapabilitiesEvent> { }
|
12 | 12 |
|
13 | 13 | public abstract class CapabilitiesHandler : ICapabilitiesHandler
|
14 | 14 | {
|
15 | 15 | public abstract Task<Unit> Handle(CapabilitiesEvent request, CancellationToken cancellationToken);
|
16 | 16 | }
|
17 |
| - |
18 |
| - public static class CapabilitiesExtensions |
19 |
| - { |
20 |
| - public static IDebugAdapterClientRegistry OnCapabilities(this IDebugAdapterClientRegistry registry, Action<CapabilitiesEvent> handler) |
21 |
| - { |
22 |
| - return registry.AddHandler(EventNames.Capabilities, NotificationHandler.For(handler)); |
23 |
| - } |
24 |
| - |
25 |
| - public static IDebugAdapterClientRegistry OnCapabilities(this IDebugAdapterClientRegistry registry, Action<CapabilitiesEvent, CancellationToken> handler) |
26 |
| - { |
27 |
| - return registry.AddHandler(EventNames.Capabilities, NotificationHandler.For(handler)); |
28 |
| - } |
29 |
| - |
30 |
| - public static IDebugAdapterClientRegistry OnCapabilities(this IDebugAdapterClientRegistry registry, Func<CapabilitiesEvent, Task> handler) |
31 |
| - { |
32 |
| - return registry.AddHandler(EventNames.Capabilities, NotificationHandler.For(handler)); |
33 |
| - } |
34 |
| - |
35 |
| - public static IDebugAdapterClientRegistry OnCapabilities(this IDebugAdapterClientRegistry registry, Func<CapabilitiesEvent, CancellationToken, Task> handler) |
36 |
| - { |
37 |
| - return registry.AddHandler(EventNames.Capabilities, NotificationHandler.For(handler)); |
38 |
| - } |
39 |
| - |
40 |
| - public static void SendCapabilities(this IDebugAdapterServer mediator, CapabilitiesEvent @params) |
41 |
| - { |
42 |
| - mediator.SendNotification(@params); |
43 |
| - } |
44 |
| - } |
45 | 17 | }
|
0 commit comments