Skip to content

Commit

Permalink
Fix doomemacs#5104: void-function +format-lsp-enable-on-save-maybe-h
Browse files Browse the repository at this point in the history
  • Loading branch information
hlissner committed May 27, 2021
1 parent a7d5d97 commit c9653ba
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions modules/editor/format/config.el
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,18 @@ select buffers.")

(defun +format-enable-for-lsp-on-save-maybe-h ()
"Enable LSP formatter when LSP client is available."
(remove-hook 'lsp-mode-hook #'+format-enable-for-lsp-on-save-maybe-h 'local)
(cond ((not +format-with-lsp) nil)
((bound-and-true-p lsp-mode)
(remove-hook 'lsp-mode-hook #'+format-lsp-enable-on-save-maybe-h 'local)
(when (lsp-feature? "textDocument/formatting")
(+format-enable-on-save-h))
t)
((bound-and-true-p eglot--managed-mode)
(remove-hook 'eglot-managed-mode-hook #'+format-lsp-enable-on-save-maybe-h 'local)
(when (eglot--server-capable :documentRangeFormattingProvider)
(+format-enable-on-save-h))
t)
((bound-and-true-p lsp--buffer-deferred)
(add-hook 'lsp-mode-hook #'+format-lsp-enable-on-save-maybe-h
(add-hook 'lsp-mode-hook #'+format-enable-for-lsp-on-save-maybe-h
nil 'local)
t)))

Expand Down

0 comments on commit c9653ba

Please sign in to comment.