   "Show debug information."
   (interactive)
   (when ycmd-mode
-    (let ((buffer (current-buffer))
-          (pos (point)))
-
+    (let ((data (ycmd--get-request-data)))
       (deferred:$
-        (let ((content (ycmd--standard-content buffer pos)))
-          (ycmd--request
-           "/debug_info"
-           content
-           :parser 'json-read))
-
+        (ycmd--request "/debug_info"
+                       (plist-get data :content)
+                       :parser 'json-read)
         (deferred:nextc it
           (lambda (res)
             (when res
               (with-help-window (get-buffer-create " *ycmd-debug-info*")
                 (with-current-buffer standard-output
                   (princ "ycmd debug information for buffer ")
-                  (insert (propertize (buffer-name buffer) 'face 'bold))
+                  (insert (propertize (buffer-name (plist-get data :buffer))
+                                      'face 'bold))
                   (princ " in ")
-                  (let ((mode (buffer-local-value 'major-mode buffer)))
+                  (let ((mode (buffer-local-value
+                               'major-mode (plist-get data :buffer))))
                     (insert-button (symbol-name mode)
                                    'type 'help-function
                                    'help-args (list mode)))

If SYNC is non-nil the function does not return a deferred object
and blocks until the request has finished."
  (when ycmd-mode
    (let* ((buffer (current-buffer))
           (pos (point))
           (content
            (append (ycmd--standard-content buffer pos)
                    (and ycmd-force-semantic-completion
                         (list (cons "force_semantic" t))))))
      (ycmd--request "/completions" content
                     :parser 'json-read :sync sync))))


                    (progn
                      (ycmd--handle-exception response)
                      (run-hook-with-args 'ycmd-after-exception-hook
                                          subcommand (plist-get data :buffer)
                                          (plist-get data :pos) response))
                  (when success-handler
                    (funcall success-handler response)))))))))))

