public void RegisterCapabilities(ServerCapabilities serverCapabilities)
        {
            foreach (var registrationOptions in LspHandlerDescriptorHelpers.GetStaticRegistrationOptions(
                         serverCapabilities
                         ))
            {
                var method = _handlerTypeDescriptorProvider.GetMethodForRegistrationOptions(registrationOptions);
                if (method == null)
                {
                    _logger.LogWarning("Unable to find method for given {@RegistrationOptions}", registrationOptions);
                    continue;
                }

                if (string.IsNullOrWhiteSpace(registrationOptions.Id))
                {
                    registrationOptions.Id = Guid.NewGuid().ToString();
                }

                var reg = new Registration {
                    Id              = registrationOptions.Id,
                    Method          = method,
                    RegisterOptions = registrationOptions
                };
                _registrations.AddOrUpdate(registrationOptions.Id, x => reg, (a, b) => reg);
            }

            if (serverCapabilities.Workspace == null)
            {
                _registrationSubject.OnNext(_registrations.Values);
                return;
            }

            foreach (var registrationOptions in LspHandlerDescriptorHelpers.GetStaticRegistrationOptions(
                         serverCapabilities
                         .Workspace
                         ))
            {
                var method = _handlerTypeDescriptorProvider.GetMethodForRegistrationOptions(registrationOptions);
                if (method == null)
                {
                    // TODO: Log this
                    continue;
                }

                var reg = new Registration {
                    Id              = registrationOptions.Id,
                    Method          = method,
                    RegisterOptions = registrationOptions
                };
                _registrations.AddOrUpdate(registrationOptions.Id, x => reg, (a, b) => reg);
            }
        }
        public void RegisterCapabilities(ServerCapabilities serverCapabilities)
        {
            foreach (var registrationOptions in LspHandlerDescriptorHelpers.GetStaticRegistrationOptions(serverCapabilities))
            {
                var method = _handlerTypeDescriptorProvider.GetMethodForRegistrationOptions(registrationOptions);
                if (method == null)
                {
                    _logger.LogWarning("Unable to find method for given {@RegistrationOptions}", registrationOptions);
                    continue;
                }

                if (registrationOptions.Id != null)
                {
                    var reg = new Registration {
                        Id              = registrationOptions.Id,
                        Method          = method,
                        RegisterOptions = registrationOptions
                    };
                    _registrations.AddOrUpdate(registrationOptions.Id, _ => reg, (_, _) => reg);
                }
            }

            if (serverCapabilities.Workspace != null)
            {
                foreach (var registrationOptions in LspHandlerDescriptorHelpers.GetStaticRegistrationOptions(serverCapabilities.Workspace))
                {
                    var method = _handlerTypeDescriptorProvider.GetMethodForRegistrationOptions(registrationOptions);
                    if (method == null)
                    {
                        // TODO: Log this
                        continue;
                    }

                    if (registrationOptions.Id != null)
                    {
                        var reg = new Registration {
                            Id              = registrationOptions.Id,
                            Method          = method,
                            RegisterOptions = registrationOptions
                        };
                        _registrations.AddOrUpdate(registrationOptions.Id, _ => reg, (_, _) => reg);
                    }
                }
            }

            _registrationSubject.OnNext(_registrations.Values);
        }
        public void RegisterCapabilities(ServerCapabilities serverCapabilities)
        {
            foreach (var registrationOptions in LspHandlerDescriptorHelpers.GetStaticRegistrationOptions(
                         serverCapabilities))
            {
                var descriptor = LspHandlerTypeDescriptorHelper.GetHandlerTypeForRegistrationOptions(registrationOptions);
                if (descriptor == null)
                {
                    _logger.LogWarning("Unable to find handler type descriptor for the given {@RegistrationOptions}", registrationOptions);
                    continue;
                }

                var reg = new Registration()
                {
                    Id              = registrationOptions.Id,
                    Method          = descriptor.Method,
                    RegisterOptions = registrationOptions
                };
                _registrations.AddOrUpdate(registrationOptions.Id, (x) => reg, (a, b) => reg);
            }

            if (serverCapabilities.Workspace == null)
            {
                _registrationSubject.OnNext(_registrations.Values);
                return;
            }

            foreach (var registrationOptions in LspHandlerDescriptorHelpers.GetStaticRegistrationOptions(serverCapabilities
                                                                                                         .Workspace))
            {
                var descriptor = LspHandlerTypeDescriptorHelper.GetHandlerTypeForRegistrationOptions(registrationOptions);
                if (descriptor == null)
                {
                    // TODO: Log this
                    continue;
                }

                var reg = new Registration()
                {
                    Id              = registrationOptions.Id,
                    Method          = descriptor.Method,
                    RegisterOptions = registrationOptions
                };
                _registrations.AddOrUpdate(registrationOptions.Id, (x) => reg, (a, b) => reg);
            }
        }