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 211872

Summary: Cannot use cursor in *file* templates
Product: platform Reporter: BullfrogBlues
Component: TemplatesAssignee: Martin Entlicher <mentlicher>
Status: NEW ---    
Severity: normal CC: jtulach, markiewb
Priority: P3    
Version: 7.1.1   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

Description BullfrogBlues 2012-04-27 18:13:53 UTC
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.
Comment 1 Tomas Mysik 2012-05-02 03:31:56 UTC
Not PHP specific. Please evaluate, thanks.
Comment 2 Jaroslav Tulach 2012-05-18 14:40:17 UTC
Clearly an enhancement. As far as I know there are no plans to implement anything like this. We can accept a patch however.
Comment 3 nicholas.alipaz 2012-08-22 16:35:18 UTC
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.
Comment 4 Martin Entlicher 2013-09-02 14:27:42 UTC
Can be considered together with issue #206480.