Open DoctorKrolic opened 2 years ago
Moving this to the compiler. This is failing because Roslyn go-to-def says we should be navigating to the class declaration for the MainLayout
class in the generated file, but as there is no source mapping for the type name in that declaration, we can't map that span to the Razor document.
Similar to https://github.com/dotnet/razor-tooling/issues/7099 and https://github.com/dotnet/razor-tooling/issues/7097
@chsienki Can we up the priority of this issue? I run into this issue frequently when I'm trying to walk users through the execution of a Blazor Web App and I want to navigate to the definition of the App
component from the app.MapRazorComponents<App>()
call in Program.cs.
@jjonescz Can you take a look at this?
A quick note, this might need coordination/design with tooling. The issue is the class definition in Goo.razor.g.cs
doesn't map to anything in Goo.razor
, but thats because there is nothing for it to map to. If something hacky works, like adding a zero length mapping pointing to the start of the .razor file, that would be great, but otherwise we might need to come up with something special that tooling has explicit support for.
If something hacky works, like adding a zero length mapping pointing to the start of the .razor file, that would be great
Let me try that and see what happens :)
If something hacky works, like adding a zero length mapping pointing to the start of the .razor file, that would be great
Let me try that and see what happens :)
@chsienki FYI, I have already tried that and there were problems with renaming IIRC. I think some changes in Roslyn might be necessary.
Version used: VS 2022 v17.3 Preview 1
To reproduce:
App.razor
MainLayout
Expected behavior: I appear in
MainLayout.cs
Actual behavior: Nothing happens
Demo:
Additional context: Very similar to https://github.com/dotnet/razor-tooling/issues/6399, but in https://github.com/dotnet/razor-tooling/issues/6399 the defenition is
.razor
file, while here -.cs
file