[ty] Fix bug where diagnostics could disappear after opening an external file
This happened whenever:
* Diagnostic mode was set to `openFilesOnly`
* One opened and then closed an external file (or caused the
LSP client to send notifications that a file was closed, which
may happen even when the end user doesn't actually open or close
a file)
When this happened, the entire open file set was cleared. This in turn
resulted in `should_check_file` returning `false` for any file
previously in the open file set. And thus, we'd never get any
diagnostics.
Looking at our revision history, it seems like this bug has been
present for a long time? I'm not sure. However, this bug doesn't apply
when the diagnostic mode is set to `workspace`, which might explain
why it defied reproduction.
I've also included a regression test and some extra TRACE level logs
that might help diagnose these sorts of problems in the future.
Fixes https://github.com/astral-sh/ty-vscode/issues/342