private static void Main() { Log.WriteLine("Plugin host started"); var nvim = new NvimAPI(Console.OpenStandardOutput(), Console.OpenStandardInput()); nvim.OnUnhandledRequest += (sender, request) => { // Load the plugin and get the handler asynchronously Task.Run(() => { var handler = GetPluginHandler(nvim, request.MethodName); if (handler == null) { var error = $"Could not find request handler for {request.MethodName}"; request.SendResponse(null, error); Log.WriteLine(error); return; } Log.WriteLine($"Loaded handler for \"{request.MethodName}\""); try { var result = handler(request.Arguments); request.SendResponse(result); } catch (Exception exception) { request.SendResponse(null, exception); } }); }; nvim.OnUnhandledNotification += (sender, notification) => { // Load the plugin and get the handler asynchronously Task.Run(() => { GetPluginHandler(nvim, notification.MethodName) ?.Invoke(notification.Arguments); }); }; nvim.RegisterHandler("poll", args => "ok"); nvim.RegisterHandler("specs", args => { var slnFilePath = (string)args.First(); var pluginType = GetPluginFromSolutionPath(slnFilePath); return(pluginType == null ? null : PluginHost.GetPluginSpecs(pluginType)); }); nvim.WaitForDisconnect(); Log.WriteLine("Plugin host stopping"); }