Closed Crandel closed 11 months ago
I don't use flycheck now, it's on the todo list now, PR welcome.
I check doom-modeline and it was not a flycheck status, but lsp-modeline. Will create another issue for this
Getting flycheck status on error count is possible, I just ran doom-modeline implementation of code and it shows count.
(defun doom-modeline--flycheck-count-errors ()
"Count the number of ERRORS, grouped by level.
Return an alist, where each ITEM is a cons cell whose `car' is an
error level, and whose `cdr' is the number of errors of that
level."
(let ((info 0) (warning 0) (error 0))
(mapc
(lambda (item)
(let ((count (cdr item)))
(pcase (flycheck-error-level-compilation-level (car item))
(0 (cl-incf info count))
(1 (cl-incf warning count))
(2 (cl-incf error count)))))
(flycheck-count-errors flycheck-current-errors))
`((info . ,info) (warning . ,warning) (error . ,error))))
output:
((info . 0) (warning . 0) (error . 0))
Hi @idlip, I tried your snippet but it give me this error
Error during redisplay: (mini-echo-update-overlays-when-resized #<frame emacs_float 0x5555c94e4c00>) signaled (wrong-type-argument stringp ((info . 0) (warning . 0) (error . 0)))
My setup was like this.
(mini-echo-define-segment "flycheck"
"Return flycheck info of current buffer."
:fetch
(when (bound-and-true-p flycheck-mode)
(let ((info 0) (warning 0) (error 0))
(mapc
(lambda (item)
(let ((count (cdr item)))
(pcase (flycheck-error-level-compilation-level (car item))
(0 (cl-incf info count))
(1 (cl-incf warning count))
(2 (cl-incf error count)))))
(flycheck-count-errors flycheck-current-errors))
`((info . ,info) (warning . ,warning) (error . ,error))))
)
(mini-echo-mode 1)
)
Sorry I'm total zero in elisp, but it is not possible to use flymake for Go development so I stuck with flycheck.
@Crandel @idlip flycheck segment added, please update to latest and check it.
@liuyinz Works like a charm, thank you very much
Flymake is not enough for development, so I'm very dependent on flycheck mode. Please add flycheck segment too.