Merge pull request #3030 from jsravn/format-with-lsp-if-enabled

Use lsp-format-region-or-buffer if available
This commit is contained in:
Henrik Lissner 2020-05-06 02:59:53 -04:00 committed by GitHub
commit b5c4fce0b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View file

@ -43,7 +43,6 @@
:desc "List errors" "x" #'flycheck-list-errors)
(:when (featurep! :tools lsp)
:desc "LSP Code actions" "a" #'lsp-execute-code-action
:desc "LSP Format buffer/region" "F" #'+default/lsp-format-region-or-buffer
:desc "LSP Organize imports" "i" #'lsp-organize-imports
:desc "LSP Rename" "r" #'lsp-rename
(:after lsp-mode

View file

@ -360,7 +360,6 @@
:desc "Jump to documentation" "k" #'+lookup/documentation
(:when (featurep! :tools lsp)
:desc "LSP Execute code action" "a" #'lsp-execute-code-action
:desc "LSP Format buffer/region" "F" #'+default/lsp-format-region-or-buffer
:desc "LSP Organize imports" "i" #'lsp-organize-imports
:desc "LSP Rename" "r" #'lsp-rename
(:after lsp-mode

View file

@ -219,9 +219,11 @@ snippets or single lines."
is selected)."
(interactive)
(call-interactively
(if (use-region-p)
#'+format/region
#'+format/buffer)))
(if (bound-and-true-p lsp-mode)
#'+default/lsp-format-region-or-buffer
(if (use-region-p)
#'+format/region
#'+format/buffer))))
;;