Option to run Flycheck after buffer switch #1297
I'd like to have Flycheck run after a short delay (specifically, after
The current behavior is that syntax checks occur only after modifications to the buffer, or after a save, as per the default setting of
However, it often happens that I change some configuration externally, or I make modifications in another file. Then, when I switch back to an old buffer that is supposed to now have errors in it, Flycheck does not run another check. I have to manually edit the buffer or save it. My current workflow is to switch to a buffer, insert a character, delete it, and save—after that, Flycheck will show the errors. And I feel really dumb every time I do that.
I'd propose for a new value
The text was updated successfully, but these errors were encountered:
Thanks for the idea. I like it!
The only downside I'm seeing is that with this new setting, a syntax check would begin every time you switch to this buffer, even if the buffer hasn't changed, right?
But what if your configuration file hasn't changed either? You don't need to run the syntax check, but Flycheck cannot know because it has no knowledge of the dependencies between your buffers.
It looks like the correct solution here is to make Flycheck project-aware, which is out of scope for now.
However, your suggestion is a nice compromise to that. We don't need to know the dependencies, we just run the syntax check regardless.
I'd be wary about making this new option part of the default value for
* Add new value `buffer-switch' to allowable values in `flycheck-check-syntax-automatically`, which allows the user to enable running a syntax check on a buffer switch (after a delay). * Add new user option `flycheck-buffer-switch-delay', which customizes the delay between a buffer switch and the automatic syntax check. * Introduce dependency on `switch-buffer-functions'. * Use `switch-buffer-functions' to detect buffer switches. * Add new functions `flycheck-handle-buffer-switch' and `flycheck-handle-idle-buffer-switch' to power the new syntax-checking functionality. Fixes flycheck#1297.