Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            CheckDebugMode();
            using (CoreShell.Create()) {
                var services = CoreShell.Current.ServiceManager;

                var messageFormatter = new JsonMessageFormatter();
                // StreamJsonRpc v1.4 serializer defaults
                messageFormatter.JsonSerializer.NullValueHandling   = NullValueHandling.Ignore;
                messageFormatter.JsonSerializer.ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor;
                messageFormatter.JsonSerializer.Converters.Add(new UriConverter());

                using (var cin = Console.OpenStandardInput())
                    using (var cout = Console.OpenStandardOutput())
                        using (var server = new Implementation.LanguageServer())
                            using (var rpc = new LanguageServerJsonRpc(cout, cin, messageFormatter, server)) {
                                rpc.TraceSource.Switch.Level = SourceLevels.Error;
                                rpc.SynchronizationContext   = new SingleThreadSynchronizationContext();

                                services.AddService(new UIService(rpc));
                                services.AddService(new ProgressService(rpc));
                                services.AddService(new TelemetryService(rpc));
                                services.AddService(messageFormatter.JsonSerializer);

                                var token = server.Start(services, rpc);
                                rpc.StartListening();

                                // Wait for the "exit" request, it will terminate the process.
                                token.WaitHandle.WaitOne();
                            }
            }
        }
Ejemplo n.º 2
0
 public Task LsDeleteAnalysisCache()
 => RunTest(sm => {
     using (var ls = new Implementation.LanguageServer())
         using (var ms = new MemoryStream()) {
             ls.Start(sm, new JsonRpc(ms));
             return(ls.ClearAnalysisCache(CancellationToken.None));
         }
 });
Ejemplo n.º 3
0
        public static void Main(string[] args)
        {
            CheckDebugMode();
            using (CoreShell.Create()) {
                var services = CoreShell.Current.ServiceManager;

                using (var cin = Console.OpenStandardInput())
                    using (var cout = Console.OpenStandardOutput())
                        using (var server = new Implementation.LanguageServer())
                            using (var rpc = new JsonRpc(cout, cin, server)) {
                                rpc.SynchronizationContext = new SingleThreadSynchronizationContext();
                                rpc.JsonSerializer.Converters.Add(new UriConverter());

                                services.AddService(new UIService(rpc));
                                services.AddService(new ProgressService(rpc));
                                services.AddService(new TelemetryService(rpc));
                                var token = server.Start(services, rpc);
                                rpc.StartListening();

                                // Wait for the "exit" request, it will terminate the process.
                                token.WaitHandle.WaitOne();
                            }
            }
        }