Fix #3054: format with lsp only if server is capable

And fall back to format-all otherwise.
This commit is contained in:
Henrik Lissner 2020-05-06 16:29:32 -04:00
parent da2247e3d6
commit 200ab5b9af
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -219,13 +219,15 @@ snippets or single lines."
is selected)."
(interactive)
(call-interactively
(if (bound-and-true-p lsp-mode)
(if (doom-region-active-p)
(if (and (bound-and-true-p lsp-mode)
(lsp-feature? "textDocument/rangeFormatting"))
#'lsp-format-region
#'lsp-format-buffer)
(if (use-region-p)
#'+format/region
#'+format/buffer))))
#'+format/region)
(if (and (bound-and-true-p lsp-mode)
(lsp-feature? "textDocument/formatting"))
#'lsp-format-buffer
#'+format/buffer)))
;;