Closed Parik27 closed 6 years ago
(defun lsp-ui-flycheck-enable (_)
"Enable flycheck integration for the current buffer."
(setq-local flycheck-check-syntax-automatically '(mode-enabled save))
(setq-local flycheck-checker 'lsp-ui)
(lsp-ui-flycheck-add-mode major-mode)
(add-to-list 'flycheck-checkers 'lsp-ui)
(run-with-idle-timer 1000 t
(lambda () (when (and lsp-ui-flycheck--stale-diagnostics flycheck-mode)
(flycheck-buffer)
(setq lsp-ui-flycheck--stale-diagnostics nil))))
(add-hook 'lsp-after-diagnostics-hook (lambda ()
(setq lsp-ui-flycheck--stale-diagnostics t)
;; (when flycheck-mode
;; (flycheck-buffer))
)))
This fixed it.
For posterity: here is what I use. Perhaps lsp-ui-flycheck-live-reporting
was added after this issue?
(setq flycheck-check-syntax-automatically '(save mode-enable))
;; Only run flycheck after saving or enabling a mode.
(setq lsp-ui-flycheck-live-reporting nil)
;; Make lsp-ui-flycheck honor flycheck-check-syntax-automatically
Flycheck on cquery (probably all lsp servers) is too fast. I get an error every time I type a character. I find this functionality very annoying. Is there a way to flycheck only on saving the file?