emacs-sideline / sideline-flycheck

Show flycheck errors with sideline
GNU General Public License v3.0
18 stars 5 forks source link

`flycheck-display-errors-delay` must be larger than `sideline-delay` for this to work #2

Open blahgeek opened 1 year ago

blahgeek commented 1 year ago

Apparently it currently works like this:

  1. sideline-render is called after an idle timer of sideline-delay (default 0.2s)
  2. Inside sideline-render, it calls sideline-flycheck backend which is async. sideline-flycheck only keeps the callback for future use
  3. flycheck-display-error-at-point is called after an idle timer of flycheck-display-errors-delay (default 0.9s)
  4. Inside flycheck-display-error-at-point, it calls sideline-flycheck--show which in turn calls the sideline render callback in step 2.

So this process only works when flycheck-display-error-at-point is larger than sideline-delay.

jcs090218 commented 1 year ago

Hmm... this may sounds like a trouble! What would you propose to fix this issue? Add documentation? Code fix? etc.

blahgeek commented 1 year ago

Well I guess ideally we should eliminate the async process mixed by the two different timers. I can think of two ways:

  1. Only keep the flycheck-display-error-at-point timer, synchronously call sideline-render in it. I think it should work if flycheck is the only backend, but not sure if it's possible for multiple backends.
  2. Only keep the sideline-render timer, call flycheck-display-error-at-point in it to gather the output and return synchronously. This seems better?

How do you think?

blahgeek commented 1 year ago

Only keep the sideline-render timer, call flycheck-display-error-at-point in it to gather the output and return synchronously. This seems better?

The problem of this approach is that, the re-rendering of sideline (currently based on if the symbol-at-point is different?) may not correctly update flycheck errors (e.g. one symbol contains multiple errors at different chars?)

jcs090218 commented 1 year ago

The first option sounds like more trouble since you will force render other backends as well. I would go for the second option if we go for code fix!

I suggest to add a note to the README so users acknowledge this issue. Having multiple timers seems to be normal in Emacs world, albeit awkward. I don't want to abandon flycheck's timer since it opens option to users, so other frontend packages may co-exists with this plugin. They should able to cancel other UI frontends if they only want sideline to be the only to appear on the screen.