 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))))))
+    (let ((content
+           (append (plist-get (ycmd--get-request-data) :content)
+                   (and ycmd-force-semantic-completion
+                        (list (cons "force_semantic" t))))))
       (ycmd--request "/completions" content
                      :parser 'json-read :sync sync))))
 

    (ycmd--report-status 'parsed)
    (run-hook-with-args 'ycmd-file-parse-result-hook response)))

(defun ycmd--notify-server (event-name &optional event-content-alist)
  "Send a simple event notification for EVENT-NAME to the
server, ignoring response. Optionally, include EVENT-CONTENT-ALIST
as additional content in the request."
  (let* ((buff (current-buffer))
         (pos (point))
         (content (append (cons `("event_name" . ,event-name)
                                (ycmd--standard-content buff pos))
                          event-content-alist)))
    (deferred:$
      ;; try
      (ycmd--request "/event_notification"
                     content
                     :parser 'json-read)
      (deferred:error it
        (lambda (err)
          (message "Error sending %s request: %s" event-name err)
          (ycmd--report-status 'errored))))))

(defun ycmd-notify-file-ready-to-parse ()
  "Send a notification to ycmd that the buffer is ready to be parsed.


  "Show debug information."
  (interactive)
  (when ycmd-mode
    (let ((data (ycmd--get-request-data)))
      (deferred:$
        (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 (plist-get data :buffer))
                                      'face 'bold))
                  (princ " in ")
                  (let ((mode (buffer-local-value
                               'major-mode (plist-get data :buffer))))
                    (insert-button (symbol-name mode)
                                   'type 'help-function
                                   'help-args (list mode)))
