From deb59ca4ad774d62975a8b6926bcd5faccd14409 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 7 Jul 2024 14:21:29 -0400 Subject: [PATCH] fix(format): LSP formatters before Apheleia is loaded --- modules/editor/format/config.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/editor/format/config.el b/modules/editor/format/config.el index 31ac0f6c3..e1ceb7db1 100644 --- a/modules/editor/format/config.el +++ b/modules/editor/format/config.el @@ -45,19 +45,20 @@ This is controlled by `+format-on-save-disabled-modes'." (eq +format-on-save-disabled-modes t) (not (null (memq major-mode +format-on-save-disabled-modes))))))) - :config - (add-to-list 'doom-debug-variables '(apheleia-log-only-errors . nil)) - ;; Use the formatter provided by lsp-mode and eglot, if they are available and ;; `+format-with-lsp' is non-nil. (cond ((modulep! :tools lsp +eglot) - (add-to-list 'apheleia-formatters '(eglot . +format-eglot-buffer)) (add-hook 'eglot-managed-mode-hook #'+format-toggle-eglot-formatter-h)) ((modulep! :tools lsp) - (add-to-list 'apheleia-formatters '(lsp . +format-lsp-buffer)) (add-hook 'lsp-configure-hook #'+format-enable-lsp-formatter-h) (add-hook 'lsp-unconfigure-hook #'+format-disable-lsp-formatter-h))) + :config + (add-to-list 'doom-debug-variables '(apheleia-log-only-errors . nil)) + + (add-to-list 'apheleia-formatters '(eglot . +format-eglot-buffer)) + (add-to-list 'apheleia-formatters '(lsp . +format-lsp-buffer)) + (defadvice! +format--inhibit-reformat-on-prefix-arg-a (orig-fn &optional arg) "Make it so \\[save-buffer] with prefix arg inhibits reformatting." :around #'save-buffer