run fixall on save in python

This commit is contained in:
Grant Hunter 2025-01-02 15:40:22 -07:00
parent 14118dac5e
commit aec8ecac63

View File

@ -467,8 +467,17 @@ The DWIM behaviour of this command is as follows:
python python
:after lsp-mode :after lsp-mode
:ensure flycheck :ensure flycheck
:hook ((before-save . lsp-format-buffer) :preface
(before-save . lsp-organize-imports))) (defun lsp-fix-all ()
(interactive)
(condition-case nil
(lsp-execute-code-action-by-kind "source.fixAll")
(lsp-no-code-actions
(when (called-interactively-p 'any)
(lsp--info "source.fixAll action not available")))))
:hook ((before-save . lsp-fix-all)
(before-save . lsp-organize-imports)
(before-save . lsp-format-buffer)))
(use-package (use-package
lsp-pyright lsp-pyright
:after lsp-mode :after lsp-mode