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)."
|
||||
(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)))
|
||||
|
||||
|
||||
;;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue