示例#1
0
        static async Task Main(string[] args)
        {
            var server = new LanguageServer(Console.OpenStandardInput(), Console.OpenStandardOutput(), new LoggerFactory());
            var parser = new SimpleIniParser(server);

            server.AddHandlers(
                new TextDocumentHandler(server, parser),
                new CompletionHandler(parser)
                );

            await server.Initialize();

            await server.WaitForExit;
        }
示例#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);
        }