private IHtmlTagDeclaredElement GetOrCreateTagLocked(string name) { IHtmlTagDeclaredElement tag; if (!tags.TryGetValue(name, out tag)) { var psiServices = solution.GetComponent <IPsiServices>(); var htmlDeclaredElementsCache = solution.GetComponent <HtmlDeclaredElementsCache>(); var ownAttributes = new List <AttributeInfo>(); var inheritedAttributes = new List <AttributeInfo>(); tag = new AngularJsHtmlTagDeclaredElement(psiServices, htmlDeclaredElementsCache, name, ownAttributes, inheritedAttributes); // Stupid circular references. Populate the attributes after creating the tag, so // that the attribute can reference the tag var ownAttributeInfos = GetParameterAttributeInfosLocked(tag) .Concat(GetSpecificAttributeInfosLocked(tag) .Distinct(ai => ai.AttributeDeclaredElement.ShortName)); ownAttributes.AddRange(ownAttributeInfos); // Only include common attributes if they're not already part of the own attributes var ownAttributeNames = ownAttributes.ToHashSet(a => a.AttributeDeclaredElement.ShortName); var inheritedAttributeInfos = GetCommonAttributeInfosLocked() .Where(ai => !ownAttributeNames.Contains(ai.AttributeDeclaredElement.ShortName)); inheritedAttributes.AddRange(inheritedAttributeInfos); tags.Add(name, tag); } return(tag); }
private IHtmlTagDeclaredElement GetOrCreateTagLocked(string name) { IHtmlTagDeclaredElement tag; if (!tags.TryGetValue(name, out tag)) { var psiServices = solution.GetComponent<IPsiServices>(); var htmlDeclaredElementsCache = solution.GetComponent<HtmlDeclaredElementsCache>(); var ownAttributes = new List<AttributeInfo>(); var inheritedAttributes = new List<AttributeInfo>(); tag = new AngularJsHtmlTagDeclaredElement(psiServices, htmlDeclaredElementsCache, name, ownAttributes, inheritedAttributes); // Stupid circular references. Populate the attributes after creating the tag, so // that the attribute can reference the tag var ownAttributeInfos = GetParameterAttributeInfosLocked(tag) .Concat(GetSpecificAttributeInfosLocked(tag) .Distinct(ai => ai.AttributeDeclaredElement.ShortName)); ownAttributes.AddRange(ownAttributeInfos); // Only include common attributes if they're not already part of the own attributes var ownAttributeNames = ownAttributes.ToHashSet(a => a.AttributeDeclaredElement.ShortName); var inheritedAttributeInfos = GetCommonAttributeInfosLocked() .Where(ai => !ownAttributeNames.Contains(ai.AttributeDeclaredElement.ShortName)); inheritedAttributes.AddRange(inheritedAttributeInfos); tags.Add(name, tag); } return tag; }