// We need to filter out the duplicate tag helper descriptors that come from the // open file in the editor. We mangle the class name for its generated code, so using that here to filter these out. internal static bool IsTagHelperFromMangledClass(TagHelperDescriptor tagHelper) { StringSegment className; if (tagHelper.IsChildContentTagHelper()) { // If this is a child content tag helper, we want to look at it's original type. // E.g, if the type name is `Test.__generated__MyComponent.ChildContent`, we want to look at `Test.__generated__MyComponent`. TrySplitNamespaceAndType(tagHelper, out var typeNamespace); return(TrySplitNamespaceAndType(typeNamespace, out var _, out className) && ComponentMetadata.IsMangledClass(className)); } return(TrySplitNamespaceAndType(tagHelper, out var _, out className) && ComponentMetadata.IsMangledClass(className)); }
// We need to filter out the duplicate tag helper descriptors that come from the // open file in the editor. We mangle the class name for its generated code, so using that here to filter these out. internal static bool IsTagHelperFromMangledClass(TagHelperDescriptor tagHelper) { var typeName = tagHelper.GetTypeName(); if (tagHelper.IsChildContentTagHelper()) { // If this is a child content tag helper, we want to look at it's original type. // E.g, if the type name is `Test.__generated__MyComponent.ChildContent`, we want to look at `Test.__generated__MyComponent`. TrySplitNamespaceAndType(typeName, out var namespaceTextSpan, out var _); typeName = GetTextSpanContent(namespaceTextSpan, typeName); } if (!TrySplitNamespaceAndType(typeName, out var _, out var classNameTextSpan)) { return(false); } var className = GetTextSpanContent(classNameTextSpan, typeName); return(ComponentMetadata.IsMangledClass(className)); }