Bug 211872 - Cannot use cursor in *file* templates
Cannot use cursor in *file* templates
Status: NEW
Product: platform
Classification: Unclassified
Component: Templates
7.1.1
All All
: P3 with 4 votes (vote)
: TBD
Assigned To: Martin Entlicher
issues@platform
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-27 18:13 UTC by BullfrogBlues
Modified: 2013-09-02 14:27 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo