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 214709

Summary: Template expansion not working inside single and double quotation marks
Product: php Reporter: harlionel
Component: EditorAssignee: Ondrej Brejla <obrejla>
Status: REOPENED ---    
Severity: normal    
Priority: P3    
Version: 7.1.2   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

Description harlionel 2012-06-25 12:05:58 UTC
Product Version = NetBeans IDE 7.1.2 (Build 201204101705)
Operating System = Windows 7 version 6.1 running on x86
Java; VM; Vendor = 1.6.0_22
Runtime = Java HotSpot(TM) Client VM 17.1-b03

Language: PHP and Javascript
Template expansion not working inside single and double quotation marks
Comment 1 Ondrej Brejla 2012-06-25 13:00:14 UTC
Provide me some case, when it's a valid feature request? Then simply reopen this request. I can't imagine anyone. Thanks.

Templates weren't designed to be expanded inside strings and such afaik.
Comment 2 harlionel 2012-06-25 13:13:07 UTC
Maybe the template word is a little confusing. I mean "Code Templates".

For example:

Keys pressed: "e" then "tab"
Result: echo '[cursor-is-here]';

Then keys pressed: "a" then "tab"
Result: echo '<a href="#">Text</a>';


In the previous version I used (7.0.1) this worked. Is there a chance, to make this work again? This little feature saves me a lot of time. 

Thanks.
Comment 3 Ujigami_Guy 2012-09-06 23:48:54 UTC
+1

I used this extensively in use cases similar to this:

Abbreviation: ST
Expanded Text: {$$this->${var}}

This made it easy to insert a property of the current object into a string using php's complex/curly syntax for variable parsing.

e.g. When I wanted a string similar to "{$this->prop} blahblah", I just had to type:
"ST<tab>

Netbeans automatically entered:
"{$this->var}"
selected var, and displayed a popup list of the current object's properties for replacement.

There are many other similar use cases. e.g. s --> {$$${var}}

I see Netbeans Java now has this feature (see http://netbeans.org/bugzilla/show_bug.cgi?id=135468). Javascript must have it too since there is a Javascript Strings Code Template Language type.

Hopefully these use cases will help other users improve their productivity with Netbeans when this is fixed (currently targeted for 7.3 - thanks).
Comment 4 wookie22 2013-03-05 15:58:38 UTC
Agree completely. 

I'm also using this feature constantly every day in PHP/HTML/JavaScript so turning it off forced me to stay with 7.0.1. I even expand templates on space instead of tab because I use it so frequently. 
As PHP programmer I rarely type plain text in code (texts are mainly in mySql databases or definition/configuration files). PHP programs generate html/javascript code so html/javascript commands are mainly inside strings and not regular words.

For instance i need:

$output = '<a href="" onclick="doThis(); return false">click</a>';

in 7.0.1 which I'm using now I type this:

$output = 'AH

which expands to:

$output = '<a href="{cursor}"></a>';

then I type (in right cursor positions): 
onc -> onclick="{cursor}"
retf -> return false;

In versions higher than 7.0.1 I can't do this.

So I think it should be an option to turn on/off OR inside strings it uses code templates for plain text? I prefer first option.