public ComponentDirectiveVisitor(string filePath, IReadOnlyList <TagHelperDescriptor> tagHelpers, string currentNamespace) { _filePath = filePath; // We don't want to consider non-component tag helpers in a component document. _tagHelpers = tagHelpers.Where(t => ComponentMetadata.IsComponentTagHelperKind(t.Kind) && !IsTagHelperFromMangledClass(t)).ToList(); for (var i = 0; i < _tagHelpers.Count; i++) { var tagHelper = _tagHelpers[i]; if (tagHelper.IsComponentFullyQualifiedNameMatch()) { // If the component descriptor matches for a fully qualified name, using directives shouldn't matter. Matches.Add(tagHelper); continue; } var typeName = tagHelper.GetTypeName(); if (tagHelper.IsChildContentTagHelper()) { // If this is a child content tag helper, we want to add it if it's original type is in scope. // E.g, if the type name is `Test.MyComponent.ChildContent`, we want to add it if `Test.MyComponent` is in scope. TrySplitNamespaceAndType(typeName, out typeName, out var _); } if (currentNamespace != null && IsTypeInScope(typeName, currentNamespace)) { // Also, if the type is already in scope of the document's namespace, using isn't necessary. Matches.Add(tagHelper); } } }
public TagHelperDirectiveVisitor(IReadOnlyList <TagHelperDescriptor> tagHelpers) { // We don't want to consider components in a view document. _tagHelpers = tagHelpers.Where(t => !ComponentMetadata.IsComponentTagHelperKind(t.Kind)).ToList(); }