'"Missing template" when omitting file extensions (.html.twig) or underscore in PhpStorm

(Copy of https://craftcms.stackexchange.com/q/39067/11582)

In this project where I'm using CraftCMS I'd like to be able to only have to refer to a twig file by it's name, just like it works in JS (e.g. import './js/scripts') and SCSS (e.g. @import './variables'), without the need for file extensions or underscores.

Background info: CraftCMS uses Yii2.

However, when I try that in Twig, then first of all CraftCMS doesn't like me omitting the "_" when the file starts with one (and the IDE for that matter), and when I omit the file extension, then PhpStorm simply doesn't like it, but CraftCMS can work with it. For everything to look and work smoothly, I need to write the file name as is.

I don't know whether this is an issue with how CraftCMS configures Twig, or PhpStorm itself.

enter image description here

I'm currently on PhpStorm 2021.3.2 and following are my Symfony and Twig settings

enter image description here

enter image description here

Did I forget to change something, or is that just how it is right now?

EDIT:

https://symfony2-plugin.espend.de/languages/twig/index.html

https://github.com/Haehnchen/idea-php-symfony2-plugin/issues/1770



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source