44import com .intellij .openapi .project .DumbService ;
55import com .intellij .openapi .util .Iconable ;
66import com .intellij .psi .PsiElement ;
7- import com .intellij .psi .util .PsiTreeUtil ;
87import com .intellij .ui .LayeredIcon ;
98import com .jetbrains .twig .TwigFile ;
109import com .jetbrains .twig .elements .TwigExtendsTag ;
1110import fr .adrienbrault .idea .symfony2plugin .Settings ;
1211import fr .adrienbrault .idea .symfony2plugin .Symfony2Icons ;
1312import fr .adrienbrault .idea .symfony2plugin .Symfony2ProjectComponent ;
13+ import fr .adrienbrault .idea .symfony2plugin .extension .TwigFileUsage ;
1414import fr .adrienbrault .idea .symfony2plugin .templating .util .TwigUtil ;
1515import icons .TwigIcons ;
1616import org .jetbrains .annotations .NotNull ;
@@ -36,8 +36,7 @@ public Icon getIcon(@NotNull PsiElement element, @Iconable.IconFlags int flags)
3636 }
3737
3838 // file provides extends tag, add another layer on top; but put the layer below the previous layer if provided
39- TwigExtendsTag childOfType = PsiTreeUtil .findChildOfType (element , TwigExtendsTag .class );
40- if (childOfType != null ) {
39+ if (hasFileExtendsTag (element )) {
4140 if (icon == null ) {
4241 // we are alone so just place the icon
4342 icon = new LayeredIcon (TwigIcons .TwigFileIcon , Symfony2Icons .TWIG_EXTENDS_FILE );
@@ -52,6 +51,22 @@ public Icon getIcon(@NotNull PsiElement element, @Iconable.IconFlags int flags)
5251 return icon ;
5352 }
5453
54+ private boolean hasFileExtendsTag (@ NotNull PsiElement element ) {
55+ for (PsiElement child : element .getChildren ()) {
56+ if (child instanceof TwigExtendsTag ) {
57+ return true ;
58+ }
59+
60+ for (TwigFileUsage extension : TwigUtil .TWIG_FILE_USAGE_EXTENSIONS .getExtensions ()) {
61+ if (extension .isExtendsTemplate (child )) {
62+ return true ;
63+ }
64+ }
65+ }
66+
67+ return false ;
68+ }
69+
5570 private boolean hasController (@ NotNull TwigFile twigFile ) {
5671 return TwigUtil .findTwigFileController (twigFile ).size () > 0
5772 || TwigUtil .getTwigFileMethodUsageOnIndex (twigFile ).size () > 0 ;
0 commit comments