jyp / dante

389 stars 52 forks source link

Warnings and errors disappear after asking flycheck to reload unchanged buffer. #168

Closed sergv closed 1 year ago

sergv commented 1 year ago

I have a followup to https://github.com/jyp/dante/issues/52. After I issue flycheck-buffer for an unchanged and already checked buffer all the warnings and errors disappear.

I have investigated and reached following conclusion: the fix to #52 relies on buffer-modified-tick to determine whether buffer has changed since it was last loaded. If it didn't then cached messages from ghc will be used. What I observe is that buffer-modified-tick reports changes whereas buffer's text didn't change (I didn't edit anything) which triggers reloading of the file in ghci (as of 9.4) which doesn't produce any messages (text is actually the same since last load) which overwrites cached messages with no messages. After this subsequent calls to flycheck-buffer result in reads of overwritten cache messages. Subsequent buffer-modified-tick also report the same value.

In short I observe that something changed buffer-modified-tick without changing buffer's content since last ghci load. I don't know how to track the thing that did the change, however I think maybe dante shouldn't rely on buffer-modified-tick to check whether buffer has changed? Why not compare buffer's content by hash to see whether anything changed? I've tried it locally and didn't notice any latency increase to getting feedback from ghci.

jyp commented 1 year ago

Applied the suggested PR.