Because the lsp package sets the default checker to lsp (chaining not supported) I am using this WA to chain another checker to lsp:

(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 (derived-mode-p 'sh-mode)
              (setq my/flycheck-local-cache '((lsp . ((next-checkers . (c/c++-cppcheck)))))))))

The WA works good, the, cppcheck checker is ran after the lsp one and the cppcheck issues are shown in the buffer.

The problem is that in lsp-ui-flycheck-list and lsp-treemacs-errors-list only the errors from the lsp checker are shown. How can I add the errors from cppcheck to lsp-ui as well?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.