Skip to content

Feature: Go To Definition For Tag Helpers (and View Components) #6440

@seangwright

Description

@seangwright

Is your feature request related to a problem? Please describe.

Finding the source of a Tag Helper (or View Component Tag Helper) is very difficult in a Razor view.

For Tag Helpers here is the process I go through to 'go to definition':

  • I need to hover over the syntax highlighted attribute/element
  • Look at the namespace/type name
  • Add a using to the Razor view (if its not already in scope)
  • Create a C# code block in my Razor view
  • Type out the name I saw when hovering
  • F12 that name token

For Tag Helper View Components I do the following:

  • Hover over the <vc:some-component /> in the Razor View
  • Create a C# code block
  • Type out the name that appears in the tooltip
  • Remove the __Generated__ prefix of the type name
  • Hope I didn't typo the name and try to import a using statement for it
  • F12 that name token

Describe the solution you'd like

When I put my cursor on a Tag Helper element/attribute (or View Component) in my Razor view, I can then type F12 and be taken to the definition, either in source code of my project or the type information from an assembly/package.

Applicable Scenarios
Whenever I use Tag Helpers or View Components. So, basically every time I do any server-side HTML rendering with Razor, which is going to be every app I work on.

Describe alternatives you've considered

The alternatives are explained above.

Additional context

There was an issue opened requesting this (#5586), but it was closed and marked as a duplicate. Unfortunately, it was incorrectly marked as a duplicate since the "duplicate" was for Blazor.

This seems to be the trend of things in ASP.NET Core. Anything related to Razor is assumed to be in the context of Blazor. Those of us doing server side HTML rendering with Tag Helpers and View Components are "last year's model" and have to wait for features to trickle down 😢.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions