(Emacs/config)+flycheck-eglot to replace flymake integration of eglot
This commit is contained in:
@@ -970,6 +970,35 @@ in the minibuffer. A lot cleaner.
|
|||||||
(setq eldoc-box-position-function #'eldoc-box--default-upper-corner-position-function
|
(setq eldoc-box-position-function #'eldoc-box--default-upper-corner-position-function
|
||||||
eldoc-box-clear-with-C-g t))
|
eldoc-box-clear-with-C-g t))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
** Flycheck
|
||||||
|
Flycheck is the checking system for Emacs. I don't necessarily like
|
||||||
|
having all my code checked all the time, so I haven't added a hook to
|
||||||
|
prog-mode as it would be better for me to decide when I want checking
|
||||||
|
and when I don't.
|
||||||
|
|
||||||
|
I've added it to C/C++ mode because I use them regularly and flycheck
|
||||||
|
has very little overhead to work there.
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(use-package flycheck
|
||||||
|
:commands (flycheck-mode flycheck-list-errors)
|
||||||
|
:hook
|
||||||
|
(c-mode-hook . flycheck-mode)
|
||||||
|
(c++-mode-hook . flycheck-mode)
|
||||||
|
:general
|
||||||
|
(mode-leader
|
||||||
|
"f" #'flycheck-mode)
|
||||||
|
(code-leader
|
||||||
|
"x" #'flycheck-list-errors
|
||||||
|
"J" #'flycheck-next-error
|
||||||
|
"K" #'flycheck-previous-error)
|
||||||
|
:display
|
||||||
|
("\\*Flycheck.*"
|
||||||
|
(display-buffer-at-bottom)
|
||||||
|
(window-height . 0.25))
|
||||||
|
:config
|
||||||
|
(with-eval-after-load "evil-collection"
|
||||||
|
(evil-collection-flycheck-setup)))
|
||||||
|
#+end_src
|
||||||
** Eglot
|
** Eglot
|
||||||
Eglot is package to communicate with LSP servers for better
|
Eglot is package to communicate with LSP servers for better
|
||||||
programming capabilities. Interactions with a server provide results
|
programming capabilities. Interactions with a server provide results
|
||||||
@@ -994,36 +1023,29 @@ server when I need it.
|
|||||||
"a" #'eglot-code-actions
|
"a" #'eglot-code-actions
|
||||||
"r" #'eglot-rename
|
"r" #'eglot-rename
|
||||||
"R" #'eglot-reconnect)
|
"R" #'eglot-reconnect)
|
||||||
;; :init
|
:init
|
||||||
;; (setq eglot-stay-out-of '(flymake))
|
(setq eglot-stay-out-of '(flymake))
|
||||||
:config
|
:config
|
||||||
(add-to-list 'eglot-server-programs '((c++-mode c-mode) "clangd")))
|
(add-to-list 'eglot-server-programs '((c++-mode c-mode) "clangd")))
|
||||||
#+end_src
|
#+end_src
|
||||||
** Flycheck
|
*** Flycheck-Eglot
|
||||||
Flycheck is the checking system for Emacs. I don't necessarily like
|
By default Eglot uses the integrated flymake package for error
|
||||||
having all my code checked all the time, so I haven't added a hook to
|
reporting. I don't mind flymake, and I think an integrated solution
|
||||||
prog-mode as it would be better for me to decide when I want checking
|
which doesn't rely on external packages is always a great idea.
|
||||||
and when I don't.
|
However, I just personally prefer flycheck and it's become part of my
|
||||||
|
mental model when programming. So here's a package which will
|
||||||
|
integrate flycheck into Eglot's error reporting.
|
||||||
|
|
||||||
|
(Funny but also kind of depressing is this issue in Eglot where
|
||||||
|
someone requested this integration, which caused a bit of a flame war.
|
||||||
|
People are stupid.
|
||||||
|
[[https://github.com/joaotavora/eglot/issues/42][no opinion on
|
||||||
|
flymake]])
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package flycheck
|
(use-package flycheck-eglot
|
||||||
:commands (flycheck-mode flycheck-list-errors)
|
:straight t
|
||||||
:hook
|
:after (flycheck eglot)
|
||||||
(c-mode-hook . flycheck-mode)
|
:hook (eglot-managed-mode-hook . flycheck-eglot-mode))
|
||||||
(c++-mode-hook . flycheck-mode)
|
|
||||||
:general
|
|
||||||
(mode-leader
|
|
||||||
"f" #'flycheck-mode)
|
|
||||||
(code-leader
|
|
||||||
"x" #'flycheck-list-errors
|
|
||||||
"J" #'flycheck-next-error
|
|
||||||
"K" #'flycheck-previous-error)
|
|
||||||
:display
|
|
||||||
("\\*Flycheck.*"
|
|
||||||
(display-buffer-at-bottom)
|
|
||||||
(window-height . 0.25))
|
|
||||||
:config
|
|
||||||
(with-eval-after-load "evil-collection"
|
|
||||||
(evil-collection-flycheck-setup)))
|
|
||||||
#+end_src
|
#+end_src
|
||||||
** Tabs and spaces
|
** Tabs and spaces
|
||||||
By default, turn off tabs and set the tab width to two.
|
By default, turn off tabs and set the tab width to two.
|
||||||
|
|||||||
Reference in New Issue
Block a user