     (process-send-string proc string-to-send)
     (lean-server-after-send-cmd cmd)))
 
-(defun lean-server-process-message-with-cont (body type cont)
+(defun lean-server-process-message-with-cont (body type cont cmd-type)
   "Process the message from lean-server and call continuation"
+  (lean-server-debug "process-message-with-cont: type = %S, cmd-type = %S"
+                     type cmd-type)
+  (lean-server-debug "process-message-with-cont: body\n-----\n%s\n-----\n" body)
   (cl-case type
     (INFO
      (lean-server-debug "Process: INFO")

  (lean-server-debug "send-cmd-async: queue len = %d" (lean-server-async-task-queue-len))
  (lean-server-send-cmd cmd)
  (when cont
    (lean-server-async-task-queue-push-back cont)
    (lean-server-debug "send-cmd-async: added to %s the queue, queue size = %d"
                       (lean-cmd-type cmd)
                       (lean-server-async-task-queue-len))

(defun lean-server-async-task-queue-len ()
  (length lean-global-async-task-queue))

(defun lean-server-async-task-queue-push-back (cont cmd-type)
  (setq lean-global-async-task-queue (-snoc lean-global-async-task-queue
                                            `(,cont . ,cmd-type))))

(defun lean-server-async-task-queue-peek-front ()
  (car lean-global-async-task-queue))
