static IEnumerable <T> GetLspHandlers <T>(LspHandlerDescriptorDisposable disposable)
 {
     return(disposable.Descriptors
            .Select(z => z.Handler)
            .OfType <T>()
            .Distinct());
 }
Exemple #2
0
        private IDisposable RegisterHandlers(LspHandlerDescriptorDisposable handlerDisposable)
        {
            using (var scope = _serviceProvider.CreateScope())
            {
                var registrations = handlerDisposable.Descriptors
                                    .Select(x => x.Registration)
                                    .Where(x => x != null)
                                    .ToArray();

                // Fire and forget
                DynamicallyRegisterHandlers(registrations).ToObservable().Subscribe();

                return(new ImmutableDisposable(
                           handlerDisposable,
                           new Disposable(() =>
                {
                    Client.UnregisterCapability(new UnregistrationParams()
                    {
                        Unregisterations = registrations.ToArray()
                    }).ToObservable().Subscribe();
                })));
            }
        }
Exemple #3
0
 static IEnumerable <ILspHandlerDescriptor> GetAllDescriptors(LspHandlerDescriptorDisposable disposable)
 {
     return(disposable.Descriptors);
 }