 (defun ycmd-show-debug-info ()
   "Show debug information."
   (interactive)
-  (when ycmd-mode
-    (let ((data (ycmd--get-request-data)))
-      (deferred:$
-        (ycmd--request "/debug_info" (plist-get data :content))
-        (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)))
-                  (princ ":\n\n")
-                  (insert res)
-                  (princ "\n\n")
-                  (insert (format "Server running at: %s:%d"
-                                  ycmd-host ycmd--server-actual-port)))))))))))
+  (let* ((data (ycmd--get-request-data))
+         (buffer (plist-get data :buffer)))
+    (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))
+        (princ " in ")
+        (let ((mode (buffer-local-value 'major-mode buffer)))
+          (insert-button (symbol-name mode)
+                         'type 'help-function
+                         'help-args (list mode)))
+        (princ ":\n\n")
+        (--if-let (and (ycmd-is-server-alive?)
+                       (deferred:sync!
+                         (deferred:$
+                           (ycmd--request "/debug_info"
+                                          (plist-get data :content))
+                           (deferred:nextc it
+                             (lambda (result)
+                               result)))))
+            (princ it)
+          (princ "No debug info available from server"))
+        (princ "\n\n")
+        (princ "Server is ")
+        (let ((running (ycmd-is-server-alive?)))
+          (insert (propertize (if running "running" "not running")
+                              'face (if running 'success '(warning bold))))
+          (when running
+            (insert
+             (format " at: %s:%d" ycmd-host ycmd--server-actual-port))))
+        (princ "\n\n")
+        (princ "Ycmd Mode is ")
+        (let ((enabled (buffer-local-value 'ycmd-mode buffer)))
+          (insert (propertize (if enabled "enabled" "disabled")
+                              'face (if enabled 'success '(warning bold)))))
+        (save-excursion
+          (let ((end (point)))
+            (backward-paragraph)
+            (fill-region-as-paragraph (point) end)))
+
+        (princ "\n\n--------------------\n\n")
+        (princ (format "Ycmd version:   %s\n" (ignore-errors (ycmd-version))))
+        (princ (format "Emacs version:  %s\n" emacs-version))
+        (princ (format "System:         %s\n" system-configuration))
+        (princ (format "Window system:  %S\n" window-system))))))
 
 (defun ycmd--get-request-hmac (method path body)
   "Generate HMAC for request from METHOD, PATH and BODY."

    "---"
    ["Show debug info" ycmd-show-debug-info]
    ["Log enabled" ycmd-toggle-log-enabled
     :style toggle :selected ycmd--log-enabled]))

(defmacro ycmd--kill-timer (timer)
  "Cancel TIMER."

(require 'diff)
(require 'diff-mode)

(declare-function pkg-info-version-info "pkg-info" (package))

(defgroup ycmd nil
  "a ycmd emacs client"
