This seems to be a new regression, was working as expected last time I'd tried this. This works as expected _sometimes_.
Repro:
dotnet new blazorserverCounter.razor [Parameter]
public static string Name { get; set; }
Program.cs, Counter.Name;Program.cs on Counter.NameExpected:
2 FAR results
Actual:
Just FAR result from Program.cs
Verified CSharpDocumentExcerptService is returning appropriate results.
cc/ @dibarbet
Investigation notes:
The definition shows up (as the definition node) which should be clickable. This threw me off as I thought the definition was missing.
But the selecting the definition node to navigate to the definition tries to navigate to the generated file, which doesn't work so there's still a bug here.
The DefinitionItem has no concept of the mapped span. When VS calls back to us to navigate, we look up the DefinitionItem and attempt to navigate to the SourceSpan. This SourceSpan has the location of the generated file path, not the mapped file path. We may need to make DefinitionItem aware of the mapped paths.
We may need to make DefinitionItem aware of the mapped paths.
I would prefer we not do that. Making the core types agnostic here is the key. We don't want Razor/projection concepts leaking everywhere into the IDE. Instead, the transition from teh normal roslyn concepts to the other components should happen at the boundary points. i.e. when navigating to a generated file, we should say if it's ok to go to the originating location or not, and just have the FAR feature be totally ignorant of these types of special cases.
when navigating to a generated file, we should say if it's ok to go to the originating location or not, and just have the FAR feature be totally ignorant of these types of special cases.
@CyrusNajmabadi Yep, that's what I'm looking at right now. Although currently when a razor file is opened, the razor file is present in the workspace and it does have the mapped file (.razor) and mapped location. So navigation works (FAR returns the .razor file and location, the file exists in the workspace = navigation successful). But when the file is closed we only have the generated (.g.razor) file in the workspace, so we can't navigate to the .razor document by normal means. Currently looking into if there's a VS API I can use for that.
THat works for me. As long as we're not touchign DefinitionItems to have special knowledge of this 3rd party.
resolved in #45956