internal static bool ExpectsBooleanValue(this BoundAttributeDescriptor attribute, string name) { if (attribute.IsBooleanProperty) { return(true); } var isIndexerNameMatch = TagHelperMatchingConventions.SatisfiesBoundAttributeIndexer(name, attribute); return(isIndexerNameMatch && attribute.IsIndexerBooleanProperty); }
// Determines the full name of the Type of the property corresponding to an attribute with the given name. private static string GetPropertyType(string name, IEnumerable <TagHelperDescriptor> descriptors) { var firstBoundAttribute = FindFirstBoundAttribute(name, descriptors); var isBoundToIndexer = TagHelperMatchingConventions.SatisfiesBoundAttributeIndexer(name, firstBoundAttribute); if (isBoundToIndexer) { return(firstBoundAttribute?.IndexerTypeName); } else { return(firstBoundAttribute?.TypeName); } }
private HoverModel AttributeInfoToHover(IEnumerable <BoundAttributeDescriptor> descriptors, RangeModel range, string attributeName, ClientCapabilities clientCapabilities) { var descriptionInfos = descriptors.Select(boundAttribute => { var indexer = TagHelperMatchingConventions.SatisfiesBoundAttributeIndexer(attributeName, boundAttribute); var descriptionInfo = BoundAttributeDescriptionInfo.From(boundAttribute, indexer); return(descriptionInfo); }).ToList().AsReadOnly(); var attrDescriptionInfo = new AggregateBoundAttributeDescription(descriptionInfos); var isVSClient = clientCapabilities is PlatformAgnosticClientCapabilities platformAgnosticClientCapabilities && platformAgnosticClientCapabilities.SupportsVisualStudioExtensions; if (isVSClient && _vsLspTagHelperTooltipFactory.TryCreateTooltip(attrDescriptionInfo, out ContainerElement classifiedTextElement)) { var vsHover = new OmniSharpVSHover { Contents = new MarkedStringsOrMarkupContent(), Range = range, RawContent = classifiedTextElement, }; return(vsHover); } else { var hoverContentFormat = GetHoverContentFormat(clientCapabilities); if (!_lspTagHelperTooltipFactory.TryCreateTooltip(attrDescriptionInfo, hoverContentFormat, out var vsMarkupContent)) { return(null); } Enum.TryParse(vsMarkupContent.Kind.Value, out MarkupKind markupKind); var markupContent = new MarkupContent() { Value = vsMarkupContent.Value, Kind = markupKind, }; var hover = new HoverModel { Contents = new MarkedStringsOrMarkupContent(markupContent), Range = range }; return(hover); } }
private HoverModel AttributeInfoToHover(IEnumerable <BoundAttributeDescriptor> descriptors, RangeModel range, string attributeName) { var descriptionInfos = descriptors.Select(boundAttribute => { var indexer = TagHelperMatchingConventions.SatisfiesBoundAttributeIndexer(attributeName, boundAttribute); var descriptionInfo = BoundAttributeDescriptionInfo.From(boundAttribute, indexer); return(descriptionInfo); }).ToList().AsReadOnly(); var attrDescriptionInfo = new AggregateBoundAttributeDescription(descriptionInfos); if (!_tagHelperTooltipFactory.TryCreateTooltip(attrDescriptionInfo, out var markupContent)) { return(null); } var hover = new HoverModel { Contents = new MarkedStringsOrMarkupContent(markupContent), Range = range }; return(hover); }