public DefinitionHandler(LanguageServerWorkspace workspace, DocumentSelector documentSelector) { _workspace = workspace; _registrationOptions = new DefinitionRegistrationOptions { DocumentSelector = documentSelector }; }
public DocumentSymbolsHandler(LanguageServerWorkspace workspace, DocumentSelector documentSelector) { _workspace = workspace; _registrationOptions = new DocumentSymbolRegistrationOptions { DocumentSelector = documentSelector, }; }
public SignatureHelpHandler(LanguageServerWorkspace workspace, DocumentSelector documentSelector) { _workspace = workspace; _registrationOptions = new SignatureHelpRegistrationOptions { DocumentSelector = documentSelector };; }
public DocumentHighlightHandler(LanguageServerWorkspace workspace, DocumentSelector documentSelector) { _workspace = workspace; _registrationOptions = new DocumentHighlightRegistrationOptions { DocumentSelector = documentSelector }; }
public TextDocumentSyncHandler(LanguageServerWorkspace workspace, DocumentSelector documentSelector) { _workspace = workspace; _changeRegistrationOptions = new TextDocumentChangeRegistrationOptions { DocumentSelector = documentSelector, SyncKind = TextDocumentSyncKind.Incremental, }; }
public CompletionHandler(LanguageServerWorkspace workspace, DocumentSelector documentSelector) { _workspace = workspace; _registrationOptions = new CompletionRegistrationOptions { DocumentSelector = documentSelector, TriggerCharacters = new Container <string>(".", ":"), ResolveProvider = false }; }
public TextDocumentSyncHandler(LanguageServerWorkspace workspace, TextDocumentRegistrationOptions registrationOptions) { _workspace = workspace; _registrationOptions = registrationOptions; }
public WorkspaceSymbolsHandler(LanguageServerWorkspace workspace) { _workspace = workspace; }
internal LanguageServer( Stream input, Stream output, ILspReciever reciever, IRequestProcessIdentifier requestProcessIdentifier, ILoggerFactory loggerFactory, ISerializer serializer, IServiceCollection services, IEnumerable <Assembly> assemblies, IEnumerable <InitializeDelegate> initializeDelegates, IEnumerable <InitializedDelegate> initializedDelegates) { var outputHandler = new OutputHandler(output, serializer); services.AddLogging(); _reciever = reciever; _serializer = serializer; _supportedCapabilities = new SupportedCapabilities(); _collection = new HandlerCollection(_supportedCapabilities); _initializeDelegates = initializeDelegates; _initializedDelegates = initializedDelegates; services.AddSingleton <IOutputHandler>(outputHandler); services.AddSingleton(_collection); services.AddSingleton(_serializer); services.AddSingleton <OmniSharp.Extensions.JsonRpc.ISerializer>(_serializer); services.AddSingleton(requestProcessIdentifier); services.AddSingleton <OmniSharp.Extensions.JsonRpc.IReciever>(reciever); services.AddSingleton <ILspReciever>(reciever); services.AddSingleton(loggerFactory); 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 <ILspRequestRouter, LspRequestRouter>(); services.AddSingleton <IRequestRouter>(_ => _.GetRequiredService <ILspRequestRouter>()); 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(); _requestRouter = _serviceProvider.GetRequiredService <ILspRequestRouter>(); _responseRouter = _serviceProvider.GetRequiredService <IResponseRouter>(); _connection = ActivatorUtilities.CreateInstance <Connection>(_serviceProvider, input); _exitHandler = new ExitHandler(_shutdownHandler); _disposable.Add( AddHandlers(this, _shutdownHandler, _exitHandler, new CancelRequestHandler(_requestRouter)) ); var handlers = _serviceProvider.GetServices <IJsonRpcHandler>().ToArray(); _collection.Add(handlers); Document = new LanguageServerDocument(_responseRouter); Client = new LanguageServerClient(_responseRouter); Window = new LanguageServerWindow(_responseRouter); Workspace = new LanguageServerWorkspace(_responseRouter); }
public SignatureHelpHandler(LanguageServerWorkspace workspace, TextDocumentRegistrationOptions registrationOptions) { _workspace = workspace; _registrationOptions = registrationOptions; }