 
 (defun company-ycmd-enable-comprehensive-automatic-completion ()
   "This updates company-begin-commands so that automatic
-completion will occur after typing :: and ->. By default
-company-mode will not start automatic completion after : and >
-characters, so you need to call this if you want full automatic
-completion for C/C++."
+completion will occur after typing :: and ->. 
+
+By default company-mode will not start automatic completion
+after : and > characters, so you need to call this if you want
+full automatic completion for C/C++."
   (interactive)
   (mapcar
    (lambda (x)

(require 'ycmd)

(defconst company-ycmd-completion-properties
  '(kind
    extra_menu_info
    detailed_info
    menu_text))

(defcustom company-ycmd-modes '(c++-mode python-mode csharp-mode)
  "The list of modes for which company-ycmd will attempt completions.")

(defun company-ycmd-construct-candidate (src)
  (let ((candidate (assoc-default 'insertion_text src)))
    (dolist (prop company-ycmd-completion-properties candidate)
      (put-text-property 0 1 prop (assoc-default prop src) candidate))))

(defun company-ycmd-candidates ()
  "Get list of completion candidate structs at point."
  (if (ycmd-running?)
      (mapcar
       'company-ycmd-construct-candidate

    nil))

(defun company-ycmd-get-metadata (candidate)
  "Fetch the metadata text-property from a candidate string."
  (get-text-property 0 'detailed_info candidate))

(defun company-ycmd-get-annotation (candidate)
  "Fetch the annotation text-property from a candidate string."
  (format " [%s]" (get-text-property 0 'kind candidate)))

(defun company-ycmd-get-prefix ()
  "Prefix-command handler for the company backend."
  (and (memq major-mode company-ycmd-modes)
       buffer-file-name
       (ycmd-running?)
