Summary
The Razor component tag regex captures only PascalCase non-dotted component names (e.g. <MyButton />). Real Blazor / Razor Components codebases routinely use dotted-namespace tags (e.g. <MyApp.Components.Forms.Button />) and these are not recognized as references to the underlying component type.
Evidence
-
src/CodeIndex/Indexer/References/Languages/RazorReferenceExtractor.cs — RazorComponentTagRegex (around the file's component-detection helper, support code at line 627-681).
-
Reproducer:
@page "/"
<MyApp.Components.Forms.LoginButton OnClick="HandleClick" />
Index this file. The reference from the tag to MyApp.Components.Forms.LoginButton is missing or only the trailing segment is captured.
Impact
references on a fully-qualified Razor component type under-reports usage sites in any project that doesn't use @using blanket imports.
impact_analysis over a component is incomplete.
Proposed direction
- Extend
RazorComponentTagRegex to allow [A-Za-z_][\w]*(?:\.[A-Za-z_][\w]*)* for the tag name.
- When emitting the reference, use the fully-qualified name as the target identifier.
- Add a unit test covering both single-segment and dotted-namespace component tags.
Repro env
- Branch:
main @ 2ee912d (release v1.21.0)
Summary
The Razor component tag regex captures only PascalCase non-dotted component names (e.g.
<MyButton />). Real Blazor / Razor Components codebases routinely use dotted-namespace tags (e.g.<MyApp.Components.Forms.Button />) and these are not recognized as references to the underlying component type.Evidence
src/CodeIndex/Indexer/References/Languages/RazorReferenceExtractor.cs—RazorComponentTagRegex(around the file's component-detection helper, support code at line 627-681).Reproducer:
Index this file. The reference from the tag to
MyApp.Components.Forms.LoginButtonis missing or only the trailing segment is captured.Impact
referenceson a fully-qualified Razor component type under-reports usage sites in any project that doesn't use@usingblanket imports.impact_analysisover a component is incomplete.Proposed direction
RazorComponentTagRegexto allow[A-Za-z_][\w]*(?:\.[A-Za-z_][\w]*)*for the tag name.Repro env
main@ 2ee912d (release v1.21.0)