Esempio n. 1
0
 /// <summary>
 /// Register a description of all the notification methods supported by the RPC server
 /// </summary>
 public void RegisterNotificationMethod(NotificationType notificationType, NotificationHandler notificationHandler)
 {
     notificationMethods.Add(notificationType.Method, new NotificationMethod() { Type = notificationType, HandleNotification = notificationHandler });
 }
Esempio n. 2
0
 private void CallExit(NotificationType notificationType, object parameters)
 {
     try
     {
         OnExit();
     }
     catch (Exception e)
     {
         RemoteConsole.Error(String.Format("Error while handling notification {0} : {1}", notificationType.Method, e.Message));
     }
     finally
     {
         if (shutdownReceived)
         {
             Environment.Exit(0);
         }
         else {
             Environment.Exit(1);
         }
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Send a notification to the client
        /// </summary>
        public void SendNotification(NotificationType notificationType, object parameters)
        {
            JObject jsonMessage = new JObject();
            PrepareJsonPRCMessage(jsonMessage);

            jsonMessage["method"] = notificationType.Method;
            if (parameters != null)
            {
                jsonMessage["params"] = JToken.FromObject(parameters);
            }

            // Send text message
            messageServer.SendMessage(jsonMessage.ToString(Formatting.None));
        }
Esempio n. 4
0
 private void CallDidOpenTextDocument(NotificationType notificationType, object parameters)
 {
     try
     {
         OnDidOpenTextDocument((DidOpenTextDocumentParams)parameters);
     }
     catch (Exception e)
     {
         RemoteConsole.Error(String.Format("Error while handling notification {0} : {1}", notificationType.Method, e.Message));
     }
 }