forked from OmniSharp/csharp-language-server-protocol
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLanguageServer.cs
567 lines (487 loc) · 25.5 KB
/
LanguageServer.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Reactive.Threading.Tasks;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using MediatR;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json.Linq;
using OmniSharp.Extensions.JsonRpc;
using OmniSharp.Extensions.LanguageServer.Protocol;
using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities;
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;
using OmniSharp.Extensions.LanguageServer.Protocol.Server;
using OmniSharp.Extensions.LanguageServer.Protocol.Server.Capabilities;
using OmniSharp.Extensions.LanguageServer.Server.Abstractions;
using OmniSharp.Extensions.LanguageServer.Server.Handlers;
using OmniSharp.Extensions.LanguageServer.Server.Matchers;
using OmniSharp.Extensions.LanguageServer.Server.Pipelines;
using ISerializer = OmniSharp.Extensions.LanguageServer.Protocol.Serialization.ISerializer;
using System.Reactive.Disposables;
using Microsoft.Extensions.Options;
using OmniSharp.Extensions.LanguageServer.Server.Logging;
namespace OmniSharp.Extensions.LanguageServer.Server
{
public class LanguageServer : ILanguageServer, IInitializeHandler, IInitializedHandler, IAwaitableTermination
{
private readonly Connection _connection;
private readonly IRequestRouter<ILspHandlerDescriptor> _requestRouter;
private readonly ServerShutdownHandler _shutdownHandler = new ServerShutdownHandler();
private readonly ServerExitHandler _exitHandler;
private ClientVersion? _clientVersion;
private readonly ILspReciever _reciever;
private readonly ISerializer _serializer;
private readonly TextDocumentIdentifiers _textDocumentIdentifiers;
private readonly IHandlerCollection _collection;
private readonly IEnumerable<InitializeDelegate> _initializeDelegates;
private readonly IEnumerable<InitializedDelegate> _initializedDelegates;
private readonly IResponseRouter _responseRouter;
private readonly ISubject<InitializeResult> _initializeComplete = new AsyncSubject<InitializeResult>();
private readonly CompositeDisposable _disposable = new CompositeDisposable();
private readonly IServiceProvider _serviceProvider;
private readonly SupportedCapabilities _supportedCapabilities;
public static Task<ILanguageServer> From(Action<LanguageServerOptions> optionsAction)
{
return From(optionsAction, CancellationToken.None);
}
public static Task<ILanguageServer> From(LanguageServerOptions options)
{
return From(options, CancellationToken.None);
}
public static Task<ILanguageServer> From(Action<LanguageServerOptions> optionsAction, CancellationToken token)
{
var options = new LanguageServerOptions();
optionsAction(options);
return From(options, token);
}
public static ILanguageServer PreInit(Action<LanguageServerOptions> optionsAction)
{
var options = new LanguageServerOptions();
optionsAction(options);
return PreInit(options);
}
public static async Task<ILanguageServer> From(LanguageServerOptions options, CancellationToken token)
{
var server = (LanguageServer)PreInit(options);
await server.Initialize(token);
return server;
}
/// <summary>
/// Create the server without connecting to the client
///
/// Mainly used for unit testing
/// </summary>
/// <param name="options"></param>
/// <returns></returns>
public static ILanguageServer PreInit(LanguageServerOptions options)
{
return new LanguageServer(
options.Input,
options.Output,
options.Reciever,
options.RequestProcessIdentifier,
options.Serializer,
options.Services,
options.HandlerTypes.Select(x => x.Assembly)
.Distinct().Concat(options.HandlerAssemblies),
options.Handlers,
options.HandlerTypes,
options.NamedHandlers,
options.NamedServiceHandlers,
options.TextDocumentIdentifiers,
options.TextDocumentIdentifierTypes,
options.InitializeDelegates,
options.InitializedDelegates,
options.LoggingBuilderAction
);
}
internal LanguageServer(
Stream input,
Stream output,
ILspReciever reciever,
IRequestProcessIdentifier requestProcessIdentifier,
ISerializer serializer,
IServiceCollection services,
IEnumerable<Assembly> assemblies,
IEnumerable<IJsonRpcHandler> handlers,
IEnumerable<Type> handlerTypes,
IEnumerable<(string name, IJsonRpcHandler handler)> namedHandlers,
IEnumerable<(string name, Func<IServiceProvider, IJsonRpcHandler> handlerFunc)> namedServiceHandlers,
IEnumerable<ITextDocumentIdentifier> textDocumentIdentifiers,
IEnumerable<Type> textDocumentIdentifierTypes,
IEnumerable<InitializeDelegate> initializeDelegates,
IEnumerable<InitializedDelegate> initializedDelegates,
Action<ILoggingBuilder> loggingBuilderAction)
{
var outputHandler = new OutputHandler(output, serializer);
services.AddLogging(builder => loggingBuilderAction(builder));
services.AddSingleton<IOptionsMonitor<LoggerFilterOptions>, LanguageServerLoggerFilterOptions>();
_reciever = reciever;
_serializer = serializer;
_supportedCapabilities = new SupportedCapabilities();
_textDocumentIdentifiers = new TextDocumentIdentifiers();
var collection = new HandlerCollection(_supportedCapabilities, _textDocumentIdentifiers);
_collection = collection;
_initializeDelegates = initializeDelegates;
_initializedDelegates = initializedDelegates;
services.AddSingleton<IOutputHandler>(outputHandler);
services.AddSingleton(_collection);
services.AddSingleton(_textDocumentIdentifiers);
services.AddSingleton(_serializer);
services.AddSingleton<OmniSharp.Extensions.JsonRpc.ISerializer>(_serializer);
services.AddSingleton(requestProcessIdentifier);
services.AddSingleton<OmniSharp.Extensions.JsonRpc.IReciever>(reciever);
services.AddSingleton<ILspReciever>(reciever);
foreach (var item in handlers)
{
services.AddSingleton(item);
}
foreach (var item in textDocumentIdentifiers)
{
services.AddSingleton(item);
}
foreach (var item in handlerTypes)
{
services.AddSingleton(typeof(IJsonRpcHandler), item);
}
foreach (var item in textDocumentIdentifierTypes)
{
services.AddSingleton(typeof(ITextDocumentIdentifier), item);
}
services.AddJsonRpcMediatR(assemblies);
services.AddTransient<IHandlerMatcher, TextDocumentMatcher>();
services.AddSingleton<Protocol.Server.ILanguageServer>(this);
services.AddSingleton<ILanguageServer>(this);
services.AddTransient<IHandlerMatcher, ExecuteCommandMatcher>();
services.AddTransient<IHandlerMatcher, ResolveCommandMatcher>();
services.AddSingleton<LspRequestRouter>();
services.AddSingleton<IRequestRouter<ILspHandlerDescriptor>>(_ => _.GetRequiredService<LspRequestRouter>());
services.AddSingleton<IRequestRouter<IHandlerDescriptor>>(_ => _.GetRequiredService<LspRequestRouter>());
services.AddSingleton<IResponseRouter, ResponseRouter>();
services.AddTransient(typeof(IPipelineBehavior<,>), typeof(ResolveCommandPipeline<,>));
var foundHandlers = services
.Where(x => typeof(IJsonRpcHandler).IsAssignableFrom(x.ServiceType) && x.ServiceType != typeof(IJsonRpcHandler))
.ToArray();
// Handlers are created at the start and maintained as a singleton
foreach (var handler in foundHandlers)
{
services.Remove(handler);
if (handler.ImplementationFactory != null)
services.Add(ServiceDescriptor.Singleton(typeof(IJsonRpcHandler), handler.ImplementationFactory));
else if (handler.ImplementationInstance != null)
services.Add(ServiceDescriptor.Singleton(typeof(IJsonRpcHandler), handler.ImplementationInstance));
else
services.Add(ServiceDescriptor.Singleton(typeof(IJsonRpcHandler), handler.ImplementationType));
}
_serviceProvider = services.BuildServiceProvider();
collection.SetServiceProvider(_serviceProvider);
_requestRouter = _serviceProvider.GetRequiredService<IRequestRouter<ILspHandlerDescriptor>>();
_responseRouter = _serviceProvider.GetRequiredService<IResponseRouter>();
_connection = ActivatorUtilities.CreateInstance<Connection>(_serviceProvider, input);
_exitHandler = new ServerExitHandler(_shutdownHandler);
// We need to at least create Window here in case any handler does loggin in their constructor
Document = new LanguageServerDocument(_responseRouter);
Client = new LanguageServerClient(_responseRouter);
Window = new LanguageServerWindow(_responseRouter);
Workspace = new LanguageServerWorkspace(_responseRouter);
_disposable.Add(
AddHandlers(this, _shutdownHandler, _exitHandler, new CancelRequestHandler<ILspHandlerDescriptor>(_requestRouter))
);
var serviceHandlers = _serviceProvider.GetServices<IJsonRpcHandler>().ToArray();
var serviceIdentifiers = _serviceProvider.GetServices<ITextDocumentIdentifier>().ToArray();
_disposable.Add(_textDocumentIdentifiers.Add(serviceIdentifiers));
_disposable.Add(_collection.Add(serviceHandlers));
foreach (var (name, handler) in namedHandlers)
{
_disposable.Add(_collection.Add(name, handler));
}
foreach (var (name, handlerFunc) in namedServiceHandlers)
{
_disposable.Add(_collection.Add(name, handlerFunc(_serviceProvider)));
}
}
public ILanguageServerDocument Document { get; }
public ILanguageServerClient Client { get; }
public ILanguageServerWindow Window { get; }
public ILanguageServerWorkspace Workspace { get; }
public InitializeParams ClientSettings { get; private set; }
public InitializeResult ServerSettings { get; private set; }
public IServiceProvider Services => _serviceProvider;
public IDisposable AddHandler(string method, IJsonRpcHandler handler)
{
var handlerDisposable = _collection.Add(method, handler);
return RegisterHandlers(handlerDisposable);
}
public IDisposable AddHandler(string method, Func<IServiceProvider, IJsonRpcHandler> handlerFunc)
{
var handlerDisposable = _collection.Add(method, handlerFunc);
return RegisterHandlers(handlerDisposable);
}
public IDisposable AddHandlers(params IJsonRpcHandler[] handlers)
{
var handlerDisposable = _collection.Add(handlers);
return RegisterHandlers(handlerDisposable);
}
public IDisposable AddHandler(string method, Type handlerType)
{
var handlerDisposable = _collection.Add(method, handlerType);
return RegisterHandlers(handlerDisposable);
}
public IDisposable AddHandler<T>()
where T : IJsonRpcHandler
{
return AddHandlers(typeof(T));
}
public IDisposable AddHandlers(params Type[] handlerTypes)
{
var handlerDisposable = _collection.Add(_serviceProvider, handlerTypes);
return RegisterHandlers(handlerDisposable);
}
public IDisposable AddTextDocumentIdentifier(params ITextDocumentIdentifier[] handlers)
{
var cd = new CompositeDisposable();
foreach (var textDocumentIdentifier in handlers)
{
cd.Add(_textDocumentIdentifiers.Add(textDocumentIdentifier));
}
return cd;
}
public IDisposable AddTextDocumentIdentifier<T>() where T : ITextDocumentIdentifier
{
return _textDocumentIdentifiers.Add(ActivatorUtilities.CreateInstance<T>(_serviceProvider));
}
private IDisposable RegisterHandlers(LspHandlerDescriptorDisposable handlerDisposable)
{
using (var scope = _serviceProvider.CreateScope())
{
var registrations = handlerDisposable.Descriptors
.Where(d => d.AllowsDynamicRegistration)
.Select(d => new Registration()
{
Id = d.Id.ToString(),
Method = d.Method,
RegisterOptions = d.RegistrationOptions
})
.ToArray();
// Fire and forget
DynamicallyRegisterHandlers(registrations).ToObservable().Subscribe();
return new ImmutableDisposable(
handlerDisposable,
Disposable.Create(() =>
{
Client.UnregisterCapability(new UnregistrationParams()
{
Unregisterations = registrations.ToArray()
}).ToObservable().Subscribe();
}));
}
}
private async Task Initialize(CancellationToken token)
{
_connection.Open();
try
{
await _initializeComplete.ToTask(token);
}
catch (TaskCanceledException e)
{
_initializeComplete.OnError(e);
}
catch (Exception e)
{
_initializeComplete.OnError(e);
}
}
async Task<InitializeResult> IRequestHandler<InitializeParams, InitializeResult>.Handle(InitializeParams request, CancellationToken token)
{
ClientSettings = request;
if (request.Trace == InitializeTrace.Verbose)
{
var loggerSettings = _serviceProvider.GetService<LanguageServerLoggerSettings>();
if (loggerSettings?.MinimumLogLevel <= LogLevel.Information)
{
loggerSettings.MinimumLogLevel = LogLevel.Trace;
}
var optionsMonitor = _serviceProvider.GetService<IOptionsMonitor<LoggerFilterOptions>>() as LanguageServerLoggerFilterOptions;
if (optionsMonitor?.CurrentValue.MinLevel <= LogLevel.Information)
{
optionsMonitor.CurrentValue.MinLevel = LogLevel.Trace;
optionsMonitor.Set(optionsMonitor.CurrentValue);
}
}
_clientVersion = request.Capabilities?.GetClientVersion() ?? ClientVersion.Lsp2;
_serializer.SetClientCapabilities(_clientVersion.Value, request.Capabilities);
var supportedCapabilities = new List<ISupports>();
if (_clientVersion == ClientVersion.Lsp3)
{
if (request.Capabilities.TextDocument != null)
{
supportedCapabilities.AddRange(
LspHandlerDescriptorHelpers.GetSupportedCapabilities(request.Capabilities.TextDocument)
);
}
if (request.Capabilities.Workspace != null)
{
supportedCapabilities.AddRange(
LspHandlerDescriptorHelpers.GetSupportedCapabilities(request.Capabilities.Workspace)
);
}
}
_supportedCapabilities.Add(supportedCapabilities);
AddHandlers(_serviceProvider.GetServices<IJsonRpcHandler>().ToArray());
await Task.WhenAll(_initializeDelegates.Select(c => c(this, request)));
var textDocumentCapabilities = ClientSettings.Capabilities?.TextDocument ?? new TextDocumentClientCapabilities();
var workspaceCapabilities = ClientSettings.Capabilities?.Workspace ?? new WorkspaceClientCapabilities();
var ccp = new ClientCapabilityProvider(_collection);
var serverCapabilities = new ServerCapabilities()
{
CodeActionProvider = ccp.GetStaticOptions(textDocumentCapabilities.CodeAction).Get<ICodeActionOptions, CodeActionOptions>(CodeActionOptions.Of),
CodeLensProvider = ccp.GetStaticOptions(textDocumentCapabilities.CodeLens).Get<ICodeLensOptions, CodeLensOptions>(CodeLensOptions.Of),
CompletionProvider = ccp.GetStaticOptions(textDocumentCapabilities.Completion).Get<ICompletionOptions, CompletionOptions>(CompletionOptions.Of),
DefinitionProvider = ccp.HasStaticHandler(textDocumentCapabilities.Definition),
DocumentFormattingProvider = ccp.HasStaticHandler(textDocumentCapabilities.Formatting),
DocumentHighlightProvider = ccp.HasStaticHandler(textDocumentCapabilities.DocumentHighlight),
DocumentLinkProvider = ccp.GetStaticOptions(textDocumentCapabilities.DocumentLink).Get<IDocumentLinkOptions, DocumentLinkOptions>(DocumentLinkOptions.Of),
DocumentOnTypeFormattingProvider = ccp.GetStaticOptions(textDocumentCapabilities.OnTypeFormatting).Get<IDocumentOnTypeFormattingOptions, DocumentOnTypeFormattingOptions>(DocumentOnTypeFormattingOptions.Of),
DocumentRangeFormattingProvider = ccp.HasStaticHandler(textDocumentCapabilities.RangeFormatting),
DocumentSymbolProvider = ccp.HasStaticHandler(textDocumentCapabilities.DocumentSymbol),
ExecuteCommandProvider = ccp.GetStaticOptions(workspaceCapabilities.ExecuteCommand).Reduce<IExecuteCommandOptions, ExecuteCommandOptions>(ExecuteCommandOptions.Of),
TextDocumentSync = ccp.GetStaticOptions(textDocumentCapabilities.Synchronization).Reduce<ITextDocumentSyncOptions, TextDocumentSyncOptions>(TextDocumentSyncOptions.Of),
HoverProvider = ccp.HasStaticHandler(textDocumentCapabilities.Hover),
ReferencesProvider = ccp.HasStaticHandler(textDocumentCapabilities.References),
RenameProvider = ccp.GetStaticOptions(textDocumentCapabilities.Rename).Get<IRenameOptions, RenameOptions>(RenameOptions.Of),
SignatureHelpProvider = ccp.GetStaticOptions(textDocumentCapabilities.SignatureHelp).Get<ISignatureHelpOptions, SignatureHelpOptions>(SignatureHelpOptions.Of),
WorkspaceSymbolProvider = ccp.HasStaticHandler(workspaceCapabilities.Symbol),
ImplementationProvider = ccp.GetStaticOptions(textDocumentCapabilities.Implementation).Get<IImplementationOptions, ImplementationOptions>(ImplementationOptions.Of),
TypeDefinitionProvider = ccp.GetStaticOptions(textDocumentCapabilities.TypeDefinition).Get<ITypeDefinitionOptions, TypeDefinitionOptions>(TypeDefinitionOptions.Of),
ColorProvider = ccp.GetStaticOptions(textDocumentCapabilities.ColorProvider).Get<IColorOptions, ColorOptions>(ColorOptions.Of),
FoldingRangeProvider = ccp.GetStaticOptions(textDocumentCapabilities.FoldingRange).Get<IFoldingRangeOptions, FoldingRangeOptions>(FoldingRangeOptions.Of),
DeclarationProvider = ccp.GetStaticOptions(textDocumentCapabilities.Declaration).Get<IDeclarationOptions, DeclarationOptions>(DeclarationOptions.Of),
};
if (_collection.ContainsHandler(typeof(IDidChangeWorkspaceFoldersHandler)))
{
serverCapabilities.Workspace = new WorkspaceServerCapabilities()
{
WorkspaceFolders = new WorkspaceFolderOptions()
{
Supported = true,
ChangeNotifications = Guid.NewGuid().ToString()
}
};
}
if (ccp.HasStaticHandler(textDocumentCapabilities.Synchronization))
{
var textDocumentSyncKind = TextDocumentSyncKind.None;
if (_collection.ContainsHandler(typeof(IDidChangeTextDocumentHandler)))
{
var kinds = _collection
.Select(x => x.Handler)
.OfType<IDidChangeTextDocumentHandler>()
.Select(x => x.GetRegistrationOptions()?.SyncKind ?? TextDocumentSyncKind.None)
.Where(x => x != TextDocumentSyncKind.None)
.ToArray();
if (kinds.Any())
{
textDocumentSyncKind = kinds.Min(z => z);
}
}
if (_clientVersion == ClientVersion.Lsp2)
{
serverCapabilities.TextDocumentSync = textDocumentSyncKind;
}
else
{
serverCapabilities.TextDocumentSync = new TextDocumentSyncOptions()
{
Change = textDocumentSyncKind,
OpenClose = _collection.ContainsHandler(typeof(IDidOpenTextDocumentHandler)) || _collection.ContainsHandler(typeof(IDidCloseTextDocumentHandler)),
Save = _collection.ContainsHandler(typeof(IDidSaveTextDocumentHandler)) ?
new SaveOptions() { IncludeText = true /* TODO: Make configurable */ } :
null,
WillSave = _collection.ContainsHandler(typeof(IWillSaveTextDocumentHandler)),
WillSaveWaitUntil = _collection.ContainsHandler(typeof(IWillSaveWaitUntilTextDocumentHandler))
};
}
}
// TODO: Need a call back here
// serverCapabilities.Experimental;
_reciever.Initialized();
var result = ServerSettings = new InitializeResult() { Capabilities = serverCapabilities };
await Task.WhenAll(_initializedDelegates.Select(c => c(this, request, result)));
foreach (var item in _collection)
{
LspHandlerDescriptorHelpers.InitializeHandler(item, _supportedCapabilities, item.Handler);
}
// TODO:
if (_clientVersion == ClientVersion.Lsp2)
{
// Small delay to let client respond
await Task.Delay(100, token);
_initializeComplete.OnNext(result);
_initializeComplete.OnCompleted();
}
return result;
}
public async Task<Unit> Handle(InitializedParams @params, CancellationToken token)
{
if (_clientVersion == ClientVersion.Lsp3)
{
// Small delay to let client respond
await Task.Delay(100, token);
_initializeComplete.OnNext(ServerSettings);
_initializeComplete.OnCompleted();
}
return Unit.Value;
}
private async Task DynamicallyRegisterHandlers(Registration[] registrations)
{
if (registrations.Length == 0)
return; // No dynamic registrations supported by client.
var @params = new RegistrationParams() { Registrations = registrations };
await _initializeComplete;
await Client.RegisterCapability(@params);
}
public IObservable<bool> Shutdown => _shutdownHandler.Shutdown;
public IObservable<int> Exit => _exitHandler.Exit;
public void SendNotification(string method)
{
_responseRouter.SendNotification(method);
}
public void SendNotification<T>(string method, T @params)
{
_responseRouter.SendNotification(method, @params);
}
public Task<TResponse> SendRequest<T, TResponse>(string method, T @params)
{
return _responseRouter.SendRequest<T, TResponse>(method, @params);
}
public Task<TResponse> SendRequest<TResponse>(string method)
{
return _responseRouter.SendRequest<TResponse>(method);
}
public Task SendRequest<T>(string method, T @params)
{
return _responseRouter.SendRequest(method, @params);
}
public TaskCompletionSource<JToken> GetRequest(long id)
{
return _responseRouter.GetRequest(id);
}
public Task WasShutDown => _shutdownHandler.WasShutDown;
public Task WaitForExit => _exitHandler.WaitForExit;
public void Dispose()
{
_connection?.Dispose();
_disposable?.Dispose();
}
public IDictionary<string, JToken> Experimental { get; } = new Dictionary<string, JToken>();
}
}