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.
File templates don't allow you to set a cursor position and outputs an error in the template when you try to set a cursor position. NOTE: cursor position works in code templates but not in file templates To Reproduce ============ Open a template in the editor: (Tools > Templates > PHP/PHP File > Open in Editor) Modify the template as follows: ---SNIP---SNIP--- <?php <#assign licenseFirst = "/**"> <#assign licensePrefix = " * "> <#assign licenseLast = " */"> <#include "../Licenses/license-${project.license}.txt"> ${cursor} ---SNIP---SNIP--- Now create a new file based on the above template: New > New File... (Choose File Type) Choose the PHP File type Categories = PHP > Types = PHP File Next > Finish ACTUAL RESULT ============= (Where "|" is the cursor) ---SNIP---SNIP--- |<?php /** * Copyright (c) 2012 Your Name. All rights reserved. */ Expression cursor is undefined on line 7, column 3 in Templates/Scripting/EmptyPHP.php. ---SNIP---SNIP--- EXPECTED RESULT: =============== (Where "|" is the cursor) ---SNIP---SNIP--- <?php /** * Copyright (c) 2012 Your Name. All rights reserved. */ | ---SNIP---SNIP--- p.s. I haven't a clue what component category to put this is.
Not PHP specific. Please evaluate, thanks.
Clearly an enhancement. As far as I know there are no plans to implement anything like this. We can accept a patch however.
I would like to say that the ${cursor} variable would be useful, but moreover the true usefulness would come in allowing the file templates to be used in a similar fashion to code templates. The two types of templates should be uniformed however have a different set of default variables if necessary.
Can be considered together with issue #206480.