From 08dbff5e3b8e8e22cfecaddf9cdfc4e0e8e5c399 Mon Sep 17 00:00:00 2001 From: tslilc Date: Wed, 4 Jun 2025 15:39:07 +0100 Subject: [emacs] fix python lsp, black/isort order --- emacs/inits/20-programming.el | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/emacs/inits/20-programming.el b/emacs/inits/20-programming.el index 02f95ed..b7838d4 100644 --- a/emacs/inits/20-programming.el +++ b/emacs/inits/20-programming.el @@ -1,4 +1,4 @@ -;; Time-stamp: <2024-07-13 15h00 CEST (471b3659)> +;; Time-stamp: <2025-06-04 15h38 BST (4b100887)> ;; ----------------------------------------------------------------------------- ;; General setup @@ -24,7 +24,9 @@ :defer :config (add-to-list 'eglot-server-programs - '(bqn-mode . ("bqnlsp")))) + '(bqn-mode . ("bqnlsp"))) + (add-to-list 'eglot-server-programs + '(python-mode . ("pyright-langserver" "--stdio")))) (use-package centered-window :defer @@ -188,13 +190,18 @@ ;; ----------------------------------------------------------------------------- ;; Python +(use-package python-isort + :defer + :ensure + :commands python-isort-buffer + ) + (use-package python-black :defer - :after python + :ensure + :commands python-black-buffer :config - (setq python-black-extra-args '("-l120")) - ;; :hook (python-mode . python-black-on-save-mode-enable-dwim) - ) + (setq python-black-extra-args nil)) (use-package highlight-indent-guides :ensure @@ -205,8 +212,16 @@ (use-package python :hook (python-mode . (lambda () + (require 'highlight-indent-guides) (highlight-indent-guides-mode t) + (eglot-ensure) (visual-line-mode))) + :init + (defun my-python-save-hook () + (python-isort-buffer) + (python-black-buffer)) + + :hook (before-save-hook . my-python-save-hook) :bind (:map python-mode-map ("C-c C-f" . nil) ("M-/" . hippie-expand))) -- cgit v1.2.3