 
 (defun ycmd--on-find-file ()
   (when (ycmd--major-mode-to-file-types major-mode)
+    (setq ycmd--buffer-needs-parse t)
     (ycmd-notify-file-ready-to-parse)))
 
+(defun ycmd--on-buffer-modified (beginning end length)
+  (when (ycmd--major-mode-to-file-types major-mode)
+    (setq ycmd--buffer-needs-parse t)))
+
 (add-hook 'find-file-hook 'ycmd--on-find-file)
+(add-hook 'after-change-functions 'ycmd--on-buffer-modified)
 (add-hook 'kill-emacs-hook 'ycmd-close)
 
 (provide 'ycmd)

  (ycmd--kill-notification-timer)
  (setq ycmd--notification-timer
        (run-with-idle-timer
         2 t (lambda () (ycmd-notify-file-ready-to-parse)))))

(defun ycmd--kill-notification-timer ()
  (when ycmd--notification-timer

    (display-buffer buffer)))

(defun ycmd-notify-file-ready-to-parse ()
  (when (and ycmd--buffer-needs-parse
             (ycmd--major-mode-to-file-types major-mode))
    (let ((content (cons '("event_name" . "FileReadyToParse")
                         (ycmd--standard-content))))
      (deferred:$
