     (unless (listp it)
       (setq it (list it)))
     (mapcar 'expand-file-name it)))
+
+(defvar ycmd--mode-keywords-loaded nil)
+
+(defun ycmd--get-keywords (buffer)
+  "Get syntax keywords for BUFFER."
+  (with-current-buffer buffer
+    (let ((mode major-mode))
+      (unless (memq mode ycmd--mode-keywords-loaded)
+        (--when-let (and (functionp ycmd-get-keywords-function)
+                         (funcall ycmd-get-keywords-function mode))
+          (when (ycmd--string-list-p it)
+            (add-to-list 'ycmd--mode-keywords-loaded mode)
+            it))))))
+
+(defun ycmd--get-keywords-from-alist (mode)
+  "Get keywords from `ycmd-keywords-alist' for MODE."
+  (let ((symbols (cdr (assq mode ycmd-keywords-alist))))
+    (if (consp symbols)
+        symbols
+      (cdr (assq symbols ycmd-keywords-alist)))))
 
 (defun ycmd-get-completions (buffer pos)
   "Get completions in BUFFER for position POS from the ycmd server.

(defun ycmd--global-teardown ()
  "Teardown ycmd in all buffers."
  (ycmd--kill-timer ycmd--on-focus-timer)
  (ycmd--with-all-ycmd-buffers (ycmd--teardown)))

(defun ycmd-diagnostic-file-types (mode)

functions in `ycmd-file-parse-result-hook'."
  (when (and ycmd-mode (not (ycmd-parsing-in-progress-p)))
    (let* ((buff (current-buffer))
           (extra-content (append (when ycmd-tag-files
                                    (list 'tags))
                                  (when ycmd-seed-identifiers-with-keywords
                                    (list 'syntax-keywords))))
           (content (cons '("event_name" . "FileReadyToParse")
                          (ycmd--standard-content-with-extras
                           buff extra-content))))
