Missing Twig template in PhpStorm with Symfony Plugin

I just had the same problem as well, however I didn't want to follow @Andrey Rudenko's answer because I would lose all my project specific configuration. Instead I followed @COil's comment and jusnt invalidated my cache and the problem was solved.

File -> Invalidate Caches / Restart -> Invailidate and Restart

I had the same issue with Symfony 3 / 4 / 5. The fix is really simple.

All you have to do is add the app/Resources/views (or templates in case of Flex) directory manually to Twig namespaces as follows:

Twig namespaces settings

This way you can also support custom Twig namespaces, so PhpStorm can autocomplete those as well.


If it's not working immediately, you should invalidate the cache:

File -> Invalidate Caches / Restart