// Gets (additional) attributes that should apply to the tag. Should not return attributes that are // already known by the tag. The standard standard HtmlDeclaredElementsProvider returns only common // attributes. // Used by HtmlDeclaredElementsCache.GetAdditionalAttributesForTag so a provider can add additional // attributes to a known tag (e.g. angular attributes to a standard HTML tag) // Also used when generating descriptions for tags public IEnumerable <AttributeInfo> GetAttributeInfos(IPsiSourceFile sourceFile, IHtmlTagDeclaredElement tag, bool strict) { lock (lockObject) { // We have nothing to add to an angular tag - it already knows all angular tags if (tag is IAngularJsDeclaredElement) { return(EmptyArray <AttributeInfo> .Instance); } // Note that this includes common attributes var attributeInfos = from d in cache.Directives where d.IsAttribute && d.IsForTag(tag.ShortName) from n in GetPrefixedNames(d.Name) select new AttributeInfo(GetOrCreateAttributeLocked(n, tag), DefaultAttributeValueType.IMPLIED, null); // Get any elements that have the same name as the tag, and add the parameters as attributes // Don't include any attributes that are aleady defined by other providers (this causes the // HTML description cache component to crash) var providers = solution.GetComponents <IHtmlDeclaredElementsProvider>(); var parameterAttributeInfos = from d in cache.Directives where d.IsElement && d.Name == tag.ShortName from p in d.Parameters where !IsKnownCommonAttribute(p.Name, providers) from n in GetPrefixedNames(p.Name) select new AttributeInfo(GetOrCreateAttributeLocked(n, tag), p.IsOptional ? DefaultAttributeValueType.IMPLIED : DefaultAttributeValueType.REQUIRED, null); // Parameter attributes take precedence over attribute directives. Only include one. return(parameterAttributeInfos.Concat(attributeInfos) .Distinct(ai => ai.AttributeDeclaredElement.ShortName).ToList()); } }
private void RegisterCallbacks( [NotNull] DteProtocolModel model, [NotNull] ISolution solution ) { var host = solution.GetComponent <ProjectModelViewHost>(); // This manager will be stored in closures of callbacks. // Since the entire protocol will be deleted on file execution end, // this shouldn't cause memory leaks var astManager = new AstManager(); foreach (var provider in solution.GetComponents <IEnvDteCallbackProvider>()) { provider.RegisterCallbacks(astManager, solution, host, model); } }