Provide explicit diagnostic store flush function
- Dominant language
- Haskell
- Stars
- 423
- Forks
- 105
- PR merge metrics
- No merged PRs in 30d
Description
There's a logic in the [Diagnostics.hs](https://github.com/alanz/haskell-lsp/blob/1e5623523fa4b0d61642e6f8ae0595dd308f871c/src/Language/Haskell/LSP/Diagnostics.hs) that will append diagnostics to the existing ones if the version is the same, and create new diagnostic store (discard old one) if versions are different. At least if I understood that correctly.
This causing me a problem because LSP doesn't return version on `SaveDocument` notification, only on update document. As a consequence, when some file contains error and I try to return empty diagnostics on save, old error message is preserved. What is a bit surprising, when different error is produced, the error message got updated.
I suggest to either provide explicit public function that will flush the store for a specific URI when no error message is available, or evern better, to change behaviour of `updateDiagnostics`, so when called with version `Nothing` then the store should be flushed regardless of wether previous version is `Nothing`.
I can help with this issue if you give me a go-ahead.
Contributor guide
Assessment
This issue has not been assessed yet.