Add-on components that enhance and customize the Visual Studio integrated development environment
Thanks for reaching out!
When textDocument/publishDiagnostics messages are received by the Visual Studio LSP client, the diagnostics are normally routed through the Error List and editor Squiggle providers using the document URI as a key.
If your editor window hosts a virtual document (for example, a file opened via IVsUIShell.createDocumentWindow with an in-memory buffer and no actual file path), Visual studio doesn't know how to associate the diagnostics with that buffer.
Since the URI does not map to a real file on disk or to a workspace-registered text buffer, the diagnostics are silently ignored.
To enable diagnostics:
- Register the virtual document's text buffer with the visual studio LSP Client so it's recognized as part of the workspace, or
- Use a temporary (shadow) file with a valid file:// path or
- Manually forward diagnostics to the error list using visual studio "ErrorListProvider"
Reference: Language Server Protocol Overview - Visual Studio (Windows) | Microsoft Learn
Let me know if you need any further help with this. I will be happy to assist.
If you find this helpful, Kindly mark the provided solution as "Accept Answer", so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.