feat(default): add +default/diagnostics
Unify flycheck-list-errors and flymake-show-diagnostics-buffer under +default/diagnostics, and use consult-lsp-diagnostics if the lsp and vertico modules are active.
This commit is contained in:
parent
a10ac0e609
commit
2fdcefa831
4 changed files with 22 additions and 7 deletions
|
@ -40,9 +40,7 @@
|
||||||
:desc "Find type definition" "t" #'+lookup/type-definition
|
:desc "Find type definition" "t" #'+lookup/type-definition
|
||||||
:desc "Delete trailing whitespace" "w" #'delete-trailing-whitespace
|
:desc "Delete trailing whitespace" "w" #'delete-trailing-whitespace
|
||||||
:desc "Delete trailing newlines" "W" #'doom/delete-trailing-newlines
|
:desc "Delete trailing newlines" "W" #'doom/delete-trailing-newlines
|
||||||
:desc "List errors" "x" #'flymake-show-diagnostics-buffer
|
:desc "List errors" "x" #'+default/diagnostics
|
||||||
(:when (featurep! :checkers syntax)
|
|
||||||
:desc "List errors" "x" #'flycheck-list-errors)
|
|
||||||
(:when (and (featurep! :tools lsp) (not (featurep! :tools lsp +eglot)))
|
(:when (and (featurep! :tools lsp) (not (featurep! :tools lsp +eglot)))
|
||||||
:desc "LSP Code actions" "a" #'lsp-execute-code-action
|
:desc "LSP Code actions" "a" #'lsp-execute-code-action
|
||||||
:desc "LSP Organize imports" "o" #'lsp-organize-imports
|
:desc "LSP Organize imports" "o" #'lsp-organize-imports
|
||||||
|
|
|
@ -412,9 +412,7 @@
|
||||||
:desc "Find type definition" "t" #'+lookup/type-definition
|
:desc "Find type definition" "t" #'+lookup/type-definition
|
||||||
:desc "Delete trailing whitespace" "w" #'delete-trailing-whitespace
|
:desc "Delete trailing whitespace" "w" #'delete-trailing-whitespace
|
||||||
:desc "Delete trailing newlines" "W" #'doom/delete-trailing-newlines
|
:desc "Delete trailing newlines" "W" #'doom/delete-trailing-newlines
|
||||||
:desc "List errors" "x" #'flymake-show-diagnostics-buffer
|
:desc "List errors" "x" #'+default/diagnostics)
|
||||||
(:when (featurep! :checkers syntax)
|
|
||||||
:desc "List errors" "x" #'flycheck-list-errors))
|
|
||||||
|
|
||||||
;;; <leader> f --- file
|
;;; <leader> f --- file
|
||||||
(:prefix-map ("f" . "file")
|
(:prefix-map ("f" . "file")
|
||||||
|
|
|
@ -44,3 +44,22 @@ If ARG (universal argument), runs `compile' from the current directory."
|
||||||
(while (server-running-p)
|
(while (server-running-p)
|
||||||
(sleep-for 1))
|
(sleep-for 1))
|
||||||
(server-start))
|
(server-start))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun +default/diagnostics (&rest arg)
|
||||||
|
"List diagnostics for the current buffer/project.
|
||||||
|
If the the vertico and lsp modules are active, list lsp diagnostics for the
|
||||||
|
current project. Otherwise list them for the current buffer"
|
||||||
|
(interactive)
|
||||||
|
(cond ((and (featurep! :completion vertico)
|
||||||
|
(featurep! :tools lsp)
|
||||||
|
(bound-and-true-p lsp-mode))
|
||||||
|
(consult-lsp-diagnostics arg))
|
||||||
|
((and (featurep! :checkers syntax)
|
||||||
|
(bound-and-true-p flycheck-mode))
|
||||||
|
(flycheck-list-errors))
|
||||||
|
((bound-and-true-p flymake-mode)
|
||||||
|
(flymake-show-diagnostics-buffer))
|
||||||
|
(t
|
||||||
|
(user-error "No diagnostics backend detected. Enable flycheck or \
|
||||||
|
flymake, or set up lsp-mode if applicable (see :lang lsp)"))))
|
||||||
|
|
|
@ -78,7 +78,7 @@
|
||||||
(evil-ex-define-cmd "make" #'+evil:make)
|
(evil-ex-define-cmd "make" #'+evil:make)
|
||||||
(evil-ex-define-cmd "mk" #'+evil:make) ; convenience alias
|
(evil-ex-define-cmd "mk" #'+evil:make) ; convenience alias
|
||||||
(evil-ex-define-cmd "debug" #'+debugger/start)
|
(evil-ex-define-cmd "debug" #'+debugger/start)
|
||||||
(evil-ex-define-cmd "er[rors]" #'flycheck-list-errors)
|
(evil-ex-define-cmd "er[rors]" #'+default/diagnostics)
|
||||||
|
|
||||||
;;; File operations
|
;;; File operations
|
||||||
(evil-ex-define-cmd "cp" #'+evil:copy-this-file)
|
(evil-ex-define-cmd "cp" #'+evil:copy-this-file)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue