From 081231b73fc2a7edc0356dcdabcde398325e5780 Mon Sep 17 00:00:00 2001 From: Eloise Christian <11952260+fdeitylink@users.noreply.github.com> Date: Mon, 8 Jul 2024 21:18:49 -0400 Subject: [PATCH] fix(format): apheleia doesn't invoke lsp formatter change `+format--lsp-fn` to run `+format--lsp-fn` in context of main buffer rather than apheleia's scratch buffer so that the lsp mode can be discovered --- modules/editor/format/autoload/lsp.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/editor/format/autoload/lsp.el b/modules/editor/format/autoload/lsp.el index 0235b0763..b319478f7 100644 --- a/modules/editor/format/autoload/lsp.el +++ b/modules/editor/format/autoload/lsp.el @@ -44,9 +44,9 @@ mode unconditionally, call `+format-with-lsp-mode' instead." ;;; Apheleia formatters ;;;###autoload -(cl-defun +format-lsp-buffer (&rest plist &key callback &allow-other-keys) +(cl-defun +format-lsp-buffer (&rest plist &key buffer callback &allow-other-keys) "Format the current buffer with any available lsp-mode or eglot formatter." - (if-let* ((fn (+format--lsp-fn)) + (if-let* ((fn (with-current-buffer buffer (+format--lsp-fn))) ((apply fn plist))) (funcall callback) (funcall callback "LSP server doesn't support formatting")))