private static NotificationHandlerDelegate ForNotification1 <T>(Type targetType, MethodInfo method, HandlerProvider provider) { Type deleType = typeof(Action <T>); Action <T> action = (Action <T>)method.CreateDelegate(deleType); return((n, c) => { VoidNotificationMessage notification = (VoidNotificationMessage)n; object target = provider.CreateTargetObject(targetType, c); try { action((T)target); } catch (Exception ex) { Console.Error.WriteLine(ex); } }); }
private void OnInitialized(VoidNotificationMessage message) { if (hasConfigurationCapability) { proxy.Client.RegisterCapability(new LanguageServer.Parameters.Client.RegistrationParams { registrations = new[] { new Registration { id = Guid.NewGuid().ToString(), method = "workspace/didChangeConfiguration" } } }); } if (hasWorkspaceFolderCapability) { connection.NotificationHandlers.Set <NotificationMessage <DidChangeWorkspaceFoldersParams> >("workspace/didChangeWorkspaceFolders", OnDidChangeWorkspaceFolders); } Logger.Instance.Log("Initialized."); }