3

I'm having trouble getting Twig syntax checking and highlighting for *.php and *.tpl* files in PhpStorm? It throws a lot of syntax errors. The HTML and PHP syntax is already getting picked up.

In Settings | File Types | Twig, I can't add filetype *.php because it's already in use and it asks me to replace it.

Bas Peeters
  • 3,269
  • 4
  • 33
  • 49
  • 1
    There is no other way -- only by associating file extensions in `Settings | File Types | Twig` (yep -- pattern can only be associated with one file type at a time) . BTW -- why do you use twig in PHP files? – LazyOne May 20 '15 at 09:15
  • I use Twig in files with a PHP extension for some frameworks that load their HTML templates that way. – Bas Peeters May 20 '15 at 09:39
  • But why not renaming them with the *.html.twig extension ? – Guillaume Fache May 20 '15 at 12:23
  • That's outside the scope of the question. They're not my files and it's possible to render correct highlighting on mixed HTML, PHP and JavaScript for example. – Bas Peeters May 20 '15 at 12:24
  • 1
    Are you using Symfony2? In this case, you could use the Symfony plugin – Alessandro Lai May 20 '15 at 13:06

0 Answers0