Use apheleia instead of lsp-mode to autoformat buffers
This commit is contained in:
parent
9bbde40734
commit
dc833f1f01
2 changed files with 9 additions and 8 deletions
|
|
@ -188,17 +188,18 @@
|
|||
(use-package iedit)
|
||||
(use-package wgrep)
|
||||
|
||||
(defun reformat-by-lsp ()
|
||||
"Reformat a file using LSP actions."
|
||||
(when (bound-and-true-p lsp-mode)
|
||||
(progn
|
||||
(lsp-organize-imports)
|
||||
(lsp-format-buffer))))
|
||||
(use-package apheleia
|
||||
:config
|
||||
(apheleia-global-mode)
|
||||
(setf (alist-get 'python-mode apheleia-mode-alist)
|
||||
'(ruff-isort ruff))
|
||||
(setf (alist-get 'python-ts-mode apheleia-mode-alist)
|
||||
'(ruff-isort ruff))
|
||||
)
|
||||
|
||||
(use-package lsp-mode
|
||||
:bind (:map lsp-mode-map
|
||||
("M-?" . lsp-find-references))
|
||||
:hook (before-save . reformat-by-lsp)
|
||||
:init
|
||||
(setq lsp-keymap-prefix "C-z l")
|
||||
:config
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue