Beispiel #1
0
        public override void VisitClassDeclaration(IClassDeclaration classDeclarationParam, IHighlightingConsumer context)
        {
            base.VisitClassDeclaration(classDeclarationParam, context);

            IPsiSourceFile sourceFile = classDeclarationParam.GetSourceFile();
            string generatedClassName = T4CSharpCodeGenerator.GetClassName(sourceFile);
            if (!classDeclarationParam.IsSynthetic()
            || !generatedClassName.Equals(classDeclarationParam.DeclaredName, StringComparison.Ordinal))
                return;

            IDeclaredTypeUsage superTypeUsage = classDeclarationParam.SuperTypeUsageNodes.FirstOrDefault();
            if (superTypeUsage == null
            || T4CSharpCodeGenerator.DefaultBaseClassName.Equals(superTypeUsage.GetText(), StringComparison.Ordinal))
                return;

            ITypeElement typeElement = CSharpTypeFactory.CreateDeclaredType(superTypeUsage).GetTypeElement();
            if (typeElement == null)
                return;

            if (!typeElement.Methods.Any(IsTransformTextMethod))
                context.AddHighlighting(new MissingTransformTextMethodHighlighting(superTypeUsage));
        }