This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 212189 - file names in this format filename.html.twig use html code templates rather than twig code templates
Summary: file names in this format filename.html.twig use html code templates rather t...
Status: RESOLVED INVALID
Alias: None
Product: php
Classification: Unclassified
Component: Twig (show other bugs)
Version: 7.1.1
Hardware: All All
: P3 normal with 1 vote (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-08 12:19 UTC by Richpc
Modified: 2012-09-03 16:45 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richpc 2012-05-08 12:19:54 UTC
file names using this format filename.html.twig use html code templates rather than twig code templates.

To replicate:
Create a new file called filename.html.twig and open it with netbeans
Open the editor options and create a code template for the language 'twig' using abreviation: ifj and Expanded text: {% if %}{% endif %}
set to expand on tab.
Go back to the file filename.html.twig and type in: ifj and hit tab - nothing happens.

Open the editor options again and create the same code template but this time for the language 'html'
Go back to the file filename.html.twig and type in: ifj and hit tab - it works.

So it can be worked around by putting the code template under html, but if you then want to do filename.csv.twig it's not going to work.
Comment 1 Tomas Mysik 2012-05-18 07:52:46 UTC
Will try to look at it, thanks for reporting.
Comment 2 Ondrej Brejla 2012-09-03 12:30:43 UTC
Now it's the same as for PHP. If you have a .php file which is empty (i.e. no <?php block inside), then you can't use PHP code templates, because you are in HTML context.

You can use just HTML templates (where you can define some templates which make a new PHP block). It's the same for Twig file. If you are not inside Twig delimiters, you are in HTML context and then only HTML code templates work.

It's intended behavior.

Product Version: NetBeans IDE Dev (Build 20120903-b98711cc48ee)
Java: 1.6.0_26; Java HotSpot(TM) Client VM 20.1-b02
System: Linux version 3.2.0-29-generic-pae running on i386; UTF-8; cs_CZ (nb)
Comment 3 Richpc 2012-09-03 16:45:26 UTC
Thanks, I see what you mean, html is going to be the most common output from a twig file.

I guess I was just thinking of being inside a twig block as being in a twig context, I'll do the code completion inside delimiters from now on.

Cheers.