Rewrite eglot and flymake configs
Use eglot-workspace-configuration to pass options to LSPs rather than re-defining the list Use flymake-collection to get mypy as a flymake backend Add flymake-clippy (for rust) rather than using via rust-analyzer
This commit is contained in:
parent
14eff0bb89
commit
29f6123983
|
@ -76,23 +76,17 @@ Set treesit to fontify all elements, default was 3 (out of 4)
|
|||
(eglot-autoreconnect nil)
|
||||
:config
|
||||
(setq eglot-stay-out-of '(flymake))
|
||||
(add-to-list 'eglot-server-programs
|
||||
`((nix-mode)
|
||||
. ("nil"
|
||||
:initializationOptions
|
||||
(:nil (:nix ( :maxMemoryMB 3000
|
||||
:flake ( :autoArchive t
|
||||
:autoEvalInputs t)))))))
|
||||
(add-to-list 'eglot-server-programs
|
||||
`((rust-ts-mode rust-mode)
|
||||
. ("rust-analyzer"
|
||||
:initializationOptions
|
||||
( :check (:command "clippy")
|
||||
:procMacro (:enable t)
|
||||
:cargo ( :buildScripts (:enable t)
|
||||
:features "all")))))
|
||||
(add-to-list 'eglot-server-programs
|
||||
`((python-ts-mode python-mode) . ("pylsp"))))
|
||||
(setq-default eglot-workspace-configuration
|
||||
'( :pylsp
|
||||
( :plugins
|
||||
( :jedi_completion
|
||||
( :enabled t
|
||||
:include_params t
|
||||
:include_class_objects t
|
||||
:include_function_objects t
|
||||
:fuzzy t)
|
||||
:jedi_definition (:enabled t)
|
||||
:jedi_hover (:enabled t))))))
|
||||
#+end_src
|
||||
|
||||
* Apheleia formatting
|
||||
|
@ -115,7 +109,8 @@ Set treesit to fontify all elements, default was 3 (out of 4)
|
|||
:ensure t
|
||||
:bind (("C-c C-." . flymake-goto-next-error)
|
||||
("C-c C-," . flymake-goto-prev-error))
|
||||
:hook (prog-mode . flymake-mode))
|
||||
:hook (prog-mode . flymake-mode)
|
||||
:config (require 'flymake-collection))
|
||||
#+end_src
|
||||
|
||||
** Diagnostics in popup
|
||||
|
@ -128,6 +123,20 @@ Set treesit to fontify all elements, default was 3 (out of 4)
|
|||
(global-flymake-popon-mode +1))
|
||||
#+end_src
|
||||
|
||||
** flymake-collection
|
||||
#+begin_src emacs-lisp
|
||||
(use-package flymake-collection
|
||||
:ensure t
|
||||
:diminish
|
||||
:defer
|
||||
:after flymake)
|
||||
|
||||
(with-eval-after-load 'python
|
||||
(add-hook 'python-base-mode-hook
|
||||
(defun python-mode-setup-flymake ()
|
||||
(add-hook 'flymake-diagnostic-functions 'flymake-collection-mypy nil t))))
|
||||
#+end_src
|
||||
|
||||
** shellcheck
|
||||
#+begin_src emacs-lisp
|
||||
(use-package flymake-shellcheck
|
||||
|
@ -137,6 +146,15 @@ Set treesit to fontify all elements, default was 3 (out of 4)
|
|||
:hook (sh-mode . flymake-shellcheck-load))
|
||||
#+end_src
|
||||
|
||||
** clippy
|
||||
#+begin_src emacs-lisp
|
||||
(use-package flymake-clippy
|
||||
:ensure t
|
||||
:after flymake
|
||||
:diminish
|
||||
:hook ((rust-mode rust-ts-mode) . flymake-clippy-setup-backend))
|
||||
#+end_src
|
||||
|
||||
** eslint
|
||||
#+begin_src emacs-lisp
|
||||
(use-package flymake-eslint
|
||||
|
@ -150,7 +168,7 @@ Set treesit to fontify all elements, default was 3 (out of 4)
|
|||
#+begin_src emacs-lisp
|
||||
(use-package flymake-ruff
|
||||
:ensure t
|
||||
:after (flymake eglot)
|
||||
:after flymake
|
||||
:diminish
|
||||
:hook (python-base-mode . flymake-ruff-load))
|
||||
#+end_src
|
||||
|
@ -388,10 +406,16 @@ Set fill column to 88 and enable display in python buffers
|
|||
(use-package python
|
||||
:defer t
|
||||
:custom
|
||||
(python-check-command "mypy")
|
||||
(python-check-command (cond ((executable-find "ruff")
|
||||
"ruff check --output-format=pylint")
|
||||
((executable-find "pyflakes")
|
||||
"pyflakes")
|
||||
((executable-find "epylint")
|
||||
"epylint")
|
||||
(t "pyflakes")))
|
||||
:config
|
||||
(add-hook 'python-base-mode-hook (lambda () (my/enable-fill-column 88)))
|
||||
(setq python-ts-mode-hook python-mode-hook))
|
||||
(setq python-ts-mode-hook python-mode-hook)
|
||||
(add-hook 'python-base-mode-hook (lambda () (my/enable-fill-column 88))))
|
||||
#+end_src
|
||||
|
||||
** Rust
|
||||
|
|
Loading…
Reference in a new issue