public override void VisitMarkupMinimizedTagHelperAttribute(MarkupMinimizedTagHelperAttributeSyntax node) { Visit(node.NamePrefix); if (node.TagHelperAttributeInfo.Bound) { AddSemanticRange(node.Name, RazorSemanticTokensLegend.RazorTagHelperAttribute); } }
public override void VisitMarkupMinimizedTagHelperAttribute(MarkupMinimizedTagHelperAttributeSyntax node) { if (node.TagHelperAttributeInfo.Bound) { AddSemanticRange(node.Name, SyntaxKind.MarkupMinimizedTagHelperAttribute); } base.VisitMarkupMinimizedTagHelperAttribute(node); }
public override void VisitMarkupMinimizedTagHelperAttribute(MarkupMinimizedTagHelperAttributeSyntax node) { if (!_featureFlags.AllowMinimizedBooleanTagHelperAttributes) { // Minimized attributes are not valid for non-boolean bound attributes. TagHelperBlockRewriter // has already logged an error if it was a non-boolean bound attribute; so we can skip. return; } var element = node.FirstAncestorOrSelf <MarkupTagHelperElementSyntax>(); var descriptors = element.TagHelperInfo.BindingResult.Descriptors; var attributeName = node.Name.GetContent(); var associatedDescriptors = descriptors.Where(descriptor => descriptor.BoundAttributes.Any(attributeDescriptor => TagHelperMatchingConventions.CanSatisfyBoundAttribute(attributeName, attributeDescriptor))); if (associatedDescriptors.Any() && _renderedBoundAttributeNames.Add(attributeName)) { foreach (var associatedDescriptor in associatedDescriptors) { var associatedAttributeDescriptor = associatedDescriptor.BoundAttributes.First(a => { return(TagHelperMatchingConventions.CanSatisfyBoundAttribute(attributeName, a)); }); var expectsBooleanValue = associatedAttributeDescriptor.ExpectsBooleanValue(attributeName); if (!expectsBooleanValue) { // We do not allow minimized non-boolean bound attributes. return; } var setTagHelperProperty = new TagHelperPropertyIntermediateNode() { AttributeName = attributeName, BoundAttribute = associatedAttributeDescriptor, TagHelper = associatedDescriptor, AttributeStructure = node.TagHelperAttributeInfo.AttributeStructure, Source = null, IsIndexerNameMatch = TagHelperMatchingConventions.SatisfiesBoundAttributeIndexer(attributeName, associatedAttributeDescriptor), }; _builder.Add(setTagHelperProperty); } } else { var addHtmlAttribute = new TagHelperHtmlAttributeIntermediateNode() { AttributeName = attributeName, AttributeStructure = node.TagHelperAttributeInfo.AttributeStructure }; _builder.Add(addHtmlAttribute); } }
public override void VisitMarkupMinimizedTagHelperAttribute(MarkupMinimizedTagHelperAttributeSyntax node) { Visit(node.NamePrefix); if (node.TagHelperAttributeInfo.Bound) { var semanticKind = GetAttributeSemanticKind(node); AddSemanticRange(node.Name, semanticKind); } }
public override void VisitMarkupMinimizedTagHelperAttribute(MarkupMinimizedTagHelperAttributeSyntax node) { if (node.TagHelperAttributeInfo.Bound) { var result = new SyntaxResult(node.Name, SyntaxKind.MarkupMinimizedTagHelperAttribute, _razorCodeDocument); _syntaxNodes.Add(result); } base.VisitMarkupMinimizedTagHelperAttribute(node); }