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 183547 - "live templates" not always work.
Summary: "live templates" not always work.
Status: RESOLVED WORKSFORME
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P3 normal (vote)
Assignee: rmatous
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-06 10:24 UTC by 11mb
Modified: 2010-04-21 12:15 UTC (History)
1 user (show)

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 11mb 2010-04-06 10:24:59 UTC
The super neat function in netbeans that shows template in the autocomplete does not work well.

For example [1]:

create a new php file, start with <?php and type

<enter>
'class' <ctr>+<space>

In the list you'll find the 'cls template'.

Don't use it but type 'class Test { }' + <enter> <enter>

Type again 'class' <ctr>+<space> and the template is not there.

-------------------------
example [2] :

Create a new template:
abbr: 'test';
expanded text: '$test = 'test';

create a new php file. enter <?php
type <enter><enter>

type test, type <ctr>+<space> results in => 'No suggestions'
Comment 1 11mb 2010-04-06 10:32:33 UTC
example [2] is not a good example.. sorry :S.

example [3]

make a new template:

abbr: test

value:
# test function
function test() {
	$test = 'test';
	return $test;
}

then in the autocomplete this template doesn't show when typing #test
Comment 2 rmatous 2010-04-09 16:11:24 UTC
templates are expanded by tab key. 

1/ So, either use: test<tab>
2/or CC then use prefix matching with first characters inside the template. For your template:
function test() {
    $test = 'test';
    return $test;
}

you should use: funct<ctrl+space> and in CC you should see also your test template


So, works as designed. Naturally if you don't like it, please file an new Enhancement, thanks
Comment 3 11mb 2010-04-21 10:03:47 UTC
Hi Rmatous,

Thanks for diving into this!

I can't reproduce the functionality you're describing.

You write:
---
"2/or CC then use prefix matching with first characters inside the template. For
your template:
function test() {
    $test = 'test';
    return $test;
}

you should use: funct<ctrl+space> and in CC you should see also your test
template"
---

but when i type funct<ctrl+space> the template doesn't show up. When i type function<ctrl+space> it shows up.

I think all these 'restrictions' makes this functionality not intuitive.

What also makes this functionality 'live templates' not workable is:
if you change the testtemplate like this:

-----------------
/**
 * Function to test code tempates
 *
 * @return String
 */
function test() {
	$test = 'test';
	return $test;
}
------------------

the template won't show up anymore in the autocomplete list.

My proposal would be to change this functionality as how ZendStudio 5.5 would cope with this.

They don't look at the template itself, but they autocomplete on the abbreviation.

Thanks!

P.s.: you can also expand templates with the enter key ;)
Comment 4 Filip Zamboj 2010-04-21 12:15:39 UTC
Product Version: NetBeans IDE Dev (Build 100421-c43437331587)
Java: 1.6.0_16; Java HotSpot(TM) 64-Bit Server VM 14.2-b01 

this is not reproducible in above mentioned build. Solution proposed by reporter is enhancement and is reported against php as BUG 184604