Exemple #1
0
        private CompositeElement ResolveIncludeDirective([NotNull] IT4IncludeDirective directive)
        {
            if (LogicalSourceFile == null)
            {
                return(null);
            }
            var pathWithMacros = directive.ResolvedPath;
            var path           = IncludeResolver?.ResolvePath(pathWithMacros);

            if (path == null)
            {
                return(null);
            }
            var includeFile = T4ParsingContextHelper.ExecuteGuarded(
                path,
                directive.Once,
                () => IncludeResolver?.Resolve(pathWithMacros)
                );

            if (includeFile == null)
            {
                return(null);
            }
            return(BuildIncludedT4Tree(includeFile));
        }
Exemple #2
0
        protected override T4IncludeData Build(IT4File file)
        {
            if (file.PhysicalPsiSourceFile?.IsBeingIndirectlyUpdated() == true)
            {
                // Since the contents of this file did not change,
                // the list of its direct includes did not change either,
                // so there's no point in doing anything here
                return(null);
            }

            return(new T4IncludeData(file
                                     .GetThisAndChildrenOfType <IT4IncludeDirective>()
                                     .Where(directive => directive.IsVisibleInDocument())
                                     .Select(directive => IncludeResolver.ResolvePath(directive.ResolvedPath))
                                     .Where(path => !path.IsEmpty)
                                     .Distinct()
                                     .ToList()
                                     ));
        }