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' doesn't work for component type name in C# #7213

Open
DoctorKrolic opened this issue May 14, 2022 · 4 comments · May be fixed by #9672
Open

'Go to definition' doesn't work for component type name in C# #7213

DoctorKrolic opened this issue May 14, 2022 · 4 comments · May be fixed by #9672
Assignees
Labels
area-compiler Umbrella for all compiler issues bug Something isn't working investigate

Comments

@DoctorKrolic
Copy link
Contributor

Version used:
VS 2022 v17.3 Preview 1

To reproduce:

  1. Create blazor server-side project
  2. Go to App.razor
  3. 'Go to definition' on MainLayout

Expected behavior:
I appear in MainLayout.cs

Actual behavior:
Nothing happens

Demo:
devenv_IWr5k5l1hE

Additional context:
Very similar to #6399, but in #6399 the defenition is .razor file, while here - .cs file

@ghost ghost added the untriaged label May 14, 2022
@NTaylorMullen NTaylorMullen added bug Something isn't working investigate labels May 19, 2022
@ghost ghost removed the untriaged label May 19, 2022
@davidwengier davidwengier changed the title 'Go to definition' doesn't work inside App.razor 'Go to definition' doesn't work for component type name in C# Sep 5, 2022
@davidwengier davidwengier transferred this issue from dotnet/razor Sep 5, 2022
@davidwengier
Copy link
Contributor

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 #7099 and #7097

@chsienki chsienki added the area-compiler Umbrella for all compiler issues label Oct 28, 2022
@chsienki chsienki transferred this issue from dotnet/razor-compiler Oct 28, 2022
@ghost ghost added the untriaged label Oct 28, 2022
@chsienki chsienki removed the untriaged label Jan 5, 2023
@ghost ghost added the untriaged label Jan 5, 2023
@chsienki chsienki added this to the Backlog milestone Jan 5, 2023
@ghost ghost removed the untriaged label Jan 5, 2023
@danroth27
Copy link
Member

@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.

@chsienki
Copy link
Contributor

@jjonescz Can you take a look at this?

@davidwengier
Copy link
Contributor

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.

@jjonescz jjonescz linked a pull request Dec 6, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-compiler Umbrella for all compiler issues bug Something isn't working investigate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants