I need to assign a custom extension to be recognized as a twig file in netbeans (\'blade.php\' as \'twig\' file and give me syntax highlighting and code completion appropria
Modify the user-defined-mime-resolver.xml
file so that it looks something like this:
On Linux (Ubuntu), you can find this file at:
$HOME/.netbeans/8.2/config/Services/MIMEResolver/user-defined-mime-resolver.xml
On Windows, you can find the file at:
%AppData%\Netbeans\8.2\config\Services\MIMEResolver\user-defined-mime-resolver.xml
Basically, the first
block scans the filename of any PHP files to see if it contains the ".blade" substring. If so, the file is treated as a Twig file. If not, the second
block will treat the file as a normal PHP file.
You might need the "Twig Templates" NetBeans plugin in order to get proper highlighting:
Tools > Plugins > Available Plugins > Twig Templates
It's not perfect... Blade directives such as @include
are still highlighted as plain text. However, I feel it is a marked improvement over PHP syntax highlighting.
The following sources were extremely helpful: