From 4abd34b8b4539d4694d73dd5f2b16263d221e128 Mon Sep 17 00:00:00 2001 From: SouthFox Date: Mon, 30 Sep 2024 02:00:08 +0800 Subject: [PATCH] [feat] combine pylint and pyright-lsp --- config.org | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/config.org b/config.org index e0c221c..4885307 100644 --- a/config.org +++ b/config.org @@ -641,3 +641,22 @@ (add-to-list 'window-buffer-change-functions 'my/track-python-virtualenv) #+end_src + +同时启用 pylint 和 pyright-lsp 。 + +#+begin_src emacs-lisp +(defvar-local my/flycheck-local-cache nil) + +(defun my/flycheck-checker-get (fn checker property) + (or (alist-get property (alist-get checker my/flycheck-local-cache)) + (funcall fn checker property))) + +(advice-add 'flycheck-checker-get :around 'my/flycheck-checker-get) + +(add-hook 'lsp-managed-mode-hook + (lambda () + (when (and (string= nil (file-remote-p default-directory)) + (derived-mode-p 'python-mode)) + (setq my/flycheck-local-cache '((lsp . ((next-checkers . (python-pylint))))))))) + +#+end_src