Beispiel #1
0
        private Task Initialize(Extensions.LanguageServer.Server.ILanguageServer server, InitializeParams initializeParams)
        {
            CreateCompositionHost(initializeParams);

            // TODO: Make it easier to resolve handlers from MEF (without having to add more attributes to the services if we can help it)
            var workspace = _compositionHost.GetExport <OmniSharpWorkspace>();

            _compositionHost.GetExport <DiagnosticEventForwarder>().IsEnabled = true;

            foreach (var handler in TextDocumentSyncHandler.Enumerate(_handlers, workspace)
                     .Concat(DefinitionHandler.Enumerate(_handlers))
                     .Concat(HoverHandler.Enumerate(_handlers))
                     .Concat(CompletionHandler.Enumerate(_handlers))
                     .Concat(SignatureHelpHandler.Enumerate(_handlers))
                     .Concat(RenameHandler.Enumerate(_handlers))
                     .Concat(DocumentSymbolHandler.Enumerate(_handlers)))
            {
                server.AddHandlers(handler);
            }

            return(Task.CompletedTask);
        }
Beispiel #2
0
        private Task Initialize(InitializeParams initializeParams)
        {
            CreateCompositionHost(initializeParams);

            // TODO: Make it easier to resolve handlers from MEF (without having to add more attributes to the services if we can help it)
            var workspace = _compositionHost.GetExport <OmniSharpWorkspace>();

            _server.AddHandlers(TextDocumentSyncHandler.Enumerate(_handlers, workspace));
            _server.AddHandlers(DefinitionHandler.Enumerate(_handlers));
            _server.AddHandlers(HoverHandler.Enumerate(_handlers));
            _server.AddHandlers(CompletionHandler.Enumerate(_handlers));
            _server.AddHandlers(SignatureHelpHandler.Enumerate(_handlers));
            _server.AddHandlers(RenameHandler.Enumerate(_handlers));
            _server.AddHandlers(DocumentSymbolHandler.Enumerate(_handlers));

            _server.LogMessage(new LogMessageParams()
            {
                Message = "Added handlers... waiting for initialize...",
                Type    = MessageType.Log
            });

            return(Task.CompletedTask);
        }