emacs-lsp / lsp-ui

UI integrations for lsp-mode
https://emacs-lsp.github.io/lsp-ui
GNU General Public License v3.0
1.04k stars 139 forks source link

Control when flycheck updates #112

Closed TheBB closed 6 years ago

TheBB commented 6 years ago

Ref. discussion on reddit: https://www.reddit.com/r/emacs/comments/898xgg/what_minor_modes_do_you_always_use/dwr9mxc/?context=1

Flycheck uses the function flycheck-buffer to update syntax checker data in the current buffer. This function can be called manually, or (typically), it is triggered via flycheck-check-automatically. The latter function triggers on various events (saves, edits, you name it), and decides whether the event warrants an update by, among other things, inspecting the customizable variable flycheck-check-syntax-automatically.

This package, on the other hand, bypasses this by calling flycheck-buffer directly from lsp-after-diagnostics-hook. Now there may be good reasons for this. I'm not 100% familiar with the protocol.

Since I enjoy having control over when syntax errors update (I'm not in the mood to be told about errors while I'm typing an obviously unfinished line, for example), I've removed the hook function added by lsp-ui-flycheck-enable, and I trigger syntax checking myself by calling flycheck-buffer manually. This is fine for me, but it would be nice in the future if lsp-ui honored flycheck's settings for this.

sebastiencs commented 6 years ago

@TheBB Thanks, I have added the variable lsp-ui-flycheck-live-reporting in https://github.com/emacs-lsp/lsp-ui/commit/146efa7414a91090c494e24fac364011bc884f31

TheBB commented 6 years ago

Thanks. This works fine for me.