Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go to Definition fails over LSP for source generated files #69595

Open
davidwengier opened this issue Aug 18, 2023 · 9 comments
Open

Go to Definition fails over LSP for source generated files #69595

davidwengier opened this issue Aug 18, 2023 · 9 comments
Assignees
Milestone

Comments

@davidwengier
Copy link
Contributor

Something is violating the expectations of the new Uri code:

image

Found while investigating #69732 and there is a link to a repro solution in there, but essentially execute a Go to Def via LSP to a source generated document.

/cc @tmat @jasonmalinowski

@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Issues and PRs which have not yet been triaged by a lead label Aug 18, 2023
@jasonmalinowski
Copy link
Member

@davidwengier Nothing to do with the new URI code; this just isn't supported yet. The support is coming with #68771 and dotnet/vscode-csharp#5858.

@davidwengier
Copy link
Contributor Author

Thanks, I was just about to comment that realisation, now that I've had time to think. I was so excited to get an exception investigating that competition issue, I just logged it right away :)

@davidwengier
Copy link
Contributor Author

Feel free to close this as a dupe, though I have to ask - is that PR going to make things work in VS? Thats where I hit this, from a Razor file.

@jasonmalinowski
Copy link
Member

Oh I thought that was VS Code. Uh, regular VS will require some different work, so let's keep this open then.

@jcouv jcouv added the Area-IDE label Aug 18, 2023
@arunchndr arunchndr added the New Feature - Source Generators Source Generators label Aug 21, 2023
@arunchndr arunchndr added Bug and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Aug 21, 2023
@arunchndr arunchndr added this to the 18.0 milestone Aug 21, 2023
@dibarbet
Copy link
Member

dibarbet commented Oct 25, 2024

This still applies in VS - the editor cannot open the results provided by LSP - it throws with

StreamJsonRpc.RemoteInvocationException: There is no file system provider registered for the "source-generated" scheme.
Parameter name: remoteUri ---> System.ArgumentException: There is no file system provider registered for the "source-generated" scheme.
Parameter name: remoteUri
   at Microsoft.VisualStudio.PlatformUI.Packages.FileSystem.FileSystem.<InvokeRemoteFileSystemProviderAsync>d__66`1.MoveNext()

@jasonmalinowski
Copy link
Member

@dibarbet Does VS give us a middleware concept where we can change the request before the LSP client processes it?

@dibarbet
Copy link
Member

@jasonmalinowski I believe they do - what were you thinking of doing in it? Pointing to a different file on disk?

@jasonmalinowski
Copy link
Member

If we can act as middleware for a go to definition (or other navigation operation) we can intercept the request and replace the source-generated URI with the one we generate in %TEMP%; from there when the shell opens it we'll then fill out the content as expected.

(Even better of course would be if the platform can natively support virtual documents!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants