public IDisposable Register(Action <ILanguageServerRegistry> registryAction) { var manager = new CompositeHandlersManager(_collection); registryAction(new LangaugeServerRegistry(_serviceProvider, manager, _textDocumentIdentifiers)); return(RegisterHandlers(manager.GetDisposable())); }
public void Should_Add_Named_Handler_Type_To_Parent() { var parent = Substitute.For <IHandlersManager>(); parent.Add(Arg.Any <string>(), Arg.Any <Type>(), Arg.Any <JsonRpcHandlerOptions>()).Returns(Disposable.Empty); var manager = new CompositeHandlersManager(parent); manager.Add("mymethod", Substitute.For <Type>(), new JsonRpcHandlerOptions()); parent.Received(0).Add(Arg.Any <Type>(), Arg.Any <JsonRpcHandlerOptions>()); parent.Received(1).Add("mymethod", Arg.Any <Type>(), Arg.Any <JsonRpcHandlerOptions>()); manager.GetDisposable().Count.Should().Be(1); }
public IDisposable Register(Action <ILanguageServerRegistry> registryAction) { var manager = new CompositeHandlersManager(_handlersManager.Value); registryAction(new LangaugeServerRegistry(ResolverContext, manager, _textDocumentIdentifiers)); var result = manager.GetDisposable(); if (_instancesHasStarted.Started) { LanguageServerHelpers.InitHandlers(ResolverContext.Resolve <ILanguageServer>(), result, _supportedCapabilities.Value); } return(LanguageServerHelpers.RegisterHandlers(_hasStarted, Client, _workDoneManager.Value, _supportedCapabilities.Value, result)); }
public IDisposable Register(Action <ILanguageClientRegistry> registryAction) { var manager = new CompositeHandlersManager(_handlersManager.Value); registryAction(new LangaugeClientRegistry(ResolverContext, manager, _textDocumentIdentifiers)); var result = manager.GetDisposable(); if (_instanceHasStarted.Started) { if (_languageClient == null) { throw new NotSupportedException("Language client has not yet started... you shouldn't be here."); } LanguageClientHelpers.InitHandlers(_languageClient, result); } return(result); }