It seems that you are encountering an issue with the textDocument/publishDiagnostics method when working with virtual documents in your Visual Studio extension. While errors from local files are being processed correctly and added to the error list, the same does not occur for virtual documents.
This behavior may stem from the fact that support for Language Server Protocol (LSP) in Visual Studio is designed to work primarily in open folder/file scenarios. If your virtual documents are not being treated as standard documents by the LSP implementation, this could lead to the diagnostics not being published correctly.
To troubleshoot this issue, consider the following steps:
- Ensure Proper Document Handling: Verify that your virtual documents are being recognized correctly by the LSP and that they are associated with the appropriate content type.
- Check LSP Implementation: Review your implementation of the language server to ensure that it correctly handles diagnostics for virtual documents. You may need to adjust how diagnostics are published or how the virtual documents are registered.
- Debugging: Utilize debugging tools to trace the flow of diagnostics from the language server to the Visual Studio environment, checking for any discrepancies in how virtual documents are processed compared to local files.
- Consult Documentation: Look into the Visual Studio extensibility documentation for any specific notes regarding the handling of virtual documents with LSP.
If the issue persists, consider reaching out to the Visual Studio community or forums for additional support, as there may be others who have encountered similar challenges with virtual documents and LSP.