Fix #3054: format with lsp only if server is capable
And fall back to format-all otherwise.
This commit is contained in:
parent
da2247e3d6
commit
200ab5b9af
1 changed files with 8 additions and 6 deletions
|
@ -219,13 +219,15 @@ snippets or single lines."
|
||||||
is selected)."
|
is selected)."
|
||||||
(interactive)
|
(interactive)
|
||||||
(call-interactively
|
(call-interactively
|
||||||
(if (bound-and-true-p lsp-mode)
|
|
||||||
(if (doom-region-active-p)
|
(if (doom-region-active-p)
|
||||||
|
(if (and (bound-and-true-p lsp-mode)
|
||||||
|
(lsp-feature? "textDocument/rangeFormatting"))
|
||||||
#'lsp-format-region
|
#'lsp-format-region
|
||||||
#'lsp-format-buffer)
|
#'+format/region)
|
||||||
(if (use-region-p)
|
(if (and (bound-and-true-p lsp-mode)
|
||||||
#'+format/region
|
(lsp-feature? "textDocument/formatting"))
|
||||||
#'+format/buffer))))
|
#'lsp-format-buffer
|
||||||
|
#'+format/buffer)))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue