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
This commit is contained in:
parent
af2b1a62dc
commit
081231b73f
1 changed files with 2 additions and 2 deletions
|
@ -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")))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue