dotnet / dotnet/roslyn

Support / filter virtual documents from clients that do not support virtual content retrieval

Open
#83,078 4 comments 0 reactions 0 assignees View on GitHub
Area-IDE
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

We return virtual files for source generated documents from various features (e.g. find references). See https://github.com/dotnet/roslyn/blob/main/src/LanguageServer/Protocol/Handler/SourceGenerators/SourceGeneratedDocumentGetTextHandler.cs and https://github.com/dotnet/roslyn/issues/83077

This can cause clients that don't support virtual files to throw errors as they do not know what to do with the results:
```
✗ Language Server Rename to "BuildDisplay"
└ Error: ENOENT: no such file or directory, open 'roslyn-source-generated://d5149594-5494-4a81-af3
6-69e6c0197828/Views_Search_Results_cshtml.g.cs?documentId=b1fe10d5-747e-48ef-6c96-5ab4f7d4a61e&
hintName=Views_Search_Results_cshtml.g.cs&assemblyName=Microsoft.CodeAnalysis.Razor.Compiler&ass
emblyVersion=10.0.0.0&typeName=Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator&ass
emblyPath=%2Fusr%2Fshare%2Fdotnet%2Fsdk%2F10.0.100%2FSdks%2FMicrosoft.NET.Sdk.Razor%2Fsource-gen
erators%2FMicrosoft.CodeAnalysis.Razor.Compiler.dll'
```

We should either filter these results out, or fall back to temporary files.

cc @jasonmalinowski

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.