Seems we are able to use workspace diagnostic to report diagnostics for any files in the workspace from LSP, not just the opened ones. File this issue to do some investigation and see whether we can leverage it.
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_diagnostic