haskell / haskell-mode

Emacs mode for Haskell
http://haskell.github.io/haskell-mode/
GNU General Public License v3.0
1.33k stars 344 forks source link

Linting vanishes on warnings with no errors on reload with no change. #1758

Open sirlensalot opened 3 years ago

sirlensalot commented 3 years ago

To reproduce, load code that has warnings and no errors. Warning lint will work. Reload the code with no changes; warning lints will vanish.

It appears that the cause is the warning code does not disappear from the interactive window so presumably the starting point of the search is not reset.

purcell commented 3 years ago

IIRC this is a GHCi issue, in that warnings are only displayed the first time the file is loaded. The next time it is loaded successfully, GHCi doesn't report the warnings. I seem to remember some code in Intero and/or Dante which worked around this.

sirlensalot commented 3 years ago

Hmm that's tough. It also looks like a workaround like "touch the loaded file" doesn't do the trick either.

@purcell is there maybe a way to interact with the logic for clearing warnings in the interactive buffer? It seems to do the right thing in this case, where the warning remains (if ignored by the linter), but still gets cleared properly when a reload gives new information.

Can we leverage this somehow to lint, and only for haskell-process-reload? I'm thinking something like leveraging whatever markers might remain in the interactive buffer to lint on a reload.