 ;;; Commands
 
 ;;;###autoload
-(defalias '+format/buffer #'format-all-buffer)
+(defun +format/buffer ()
+  "Reformat the current buffer using LSP or `format-all-buffer'."
+  (interactive)
+  (call-interactively
+   (if (and (bound-and-true-p lsp-mode)
+            (lsp-feature? "textDocument/formatting"))
+       #'lsp-format-buffer
+     #'format-all-buffer)))
 
 ;;;###autoload
 (defun +format/region (beg end)

contains a syntax error in isolation. It is mostly useful for formatting
snippets or single lines."
  (interactive "rP")
  (save-restriction
    (narrow-to-region beg end)
    (let ((+format-region-p t))
      (+format/buffer))))

;;;###autoload
(defun +format/region-or-buffer ()

  (interactive)
  (call-interactively
   (if (doom-region-active-p)
       #'+format/region
     #'+format/buffer)))


;;
