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 205968 - Code completion for code templates not working in 7.1RC1
Summary: Code completion for code templates not working in 7.1RC1
Status: RESOLVED DUPLICATE of bug 206413
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.1
Hardware: PC Linux
: P3 normal with 2 votes (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-06 00:24 UTC by sidtj
Modified: 2012-01-25 14:14 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
The screenshots showing "no suggestions". (173.20 KB, application/x-gzip)
2011-12-06 00:24 UTC, sidtj
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sidtj 2011-12-06 00:24:23 UTC
Created attachment 113846 [details]
The screenshots showing "no suggestions".

Please, see the attachments.

The default 'vdoc' completion is not working inside/out a class php file.

Other templates only work *inside some class method*, not in anywhere else inside the class or out of it.

What would be the issue?
Comment 1 Ondrej Brejla 2011-12-06 08:52:01 UTC
Vdoc above the method has no sense.

Above the field, it has a sense and doesn't work for me either (there are some issues in resolving contexts).

Above an internal var, it works for me without any problem in dev build.
Comment 2 sidtj 2011-12-06 11:44:26 UTC
You are wright. 'Has no sense' a vdoc above a method. I had a docblock in mind when try to use vdoc.

Thanks for reply.
Comment 3 sidtj 2011-12-06 12:06:36 UTC
*right*, i meant.
Comment 4 Ondrej Brejla 2011-12-06 12:13:31 UTC
And of course...above the field, it has no sense too, because you should use classic phpDoc format /** @var MyObject */ instead of vdoc format /* @var $fieldName MyObject */ to let it properly work.

So it seems that it works properly for all cases. Above classic variable it works for me without any problem and your other cases have no sense.
Comment 5 sidtj 2011-12-06 12:36:05 UTC
You are right again.
Thank you so much and sorry for the time wasting.
Comment 6 tonanbarbarian 2012-01-06 01:56:29 UTC
I have created new Code templates and they do not work as expected in 7.1 when working with language set to PHP. These were all created in 7.0.1 and worked fine but no longer work after upgrade to 7.1 and import of settings.

abbrev: pub
Expanded Text:
/**
 * ${functionName}
 */
public function ${functionName}() {
	${selection}${cursor}
} // ${functionName}{}



abbrev: pubp
Expanded Text:
/**
 * Public Method ${functionName}
 *
 * @param ${paramType} $$${param} ${paramDescription}
 */
public function ${functionName}($$${param}) {
	${selection}${cursor}
} // ${functionName}{}


abbrev: pubp
Expanded Text:
/**
 * Private Method ${functionName}
 */
private function ${functionName}() {
	${selection}${cursor}
} // ${functionName}()

plus many several others in similar formats for combinations of public, private and protected, with and without parameters and return values.

If I try to use the code completion inside a class it always fails, but if I use it outside the class it works correctly.

I have even tried creating a new Code Completion called my_pub, with the same Expanded text as pub above and it still fails to work.

I have tried changing all of the Expand Template On and On Template Expansion options and it never works.

I have also noticed that the default fnc does not always work correctly inside a class.
Sometime I will type fnc and hit tab and it will NOT complete, other times it will.
It appears to be almost a timing issue as to whether it will work or not.

This all occurs when working with PHP files, I have not tested with other file types as that is all I am working with. I downloaded the PHP version of 7.1 today and just found this issue.
Comment 7 Ondrej Brejla 2012-01-06 08:54:12 UTC
I know about issues with code templates and their invocation contexts and I would like to improve them into 7.2. Have you tried to create new clean instalation? With clean user dir? Without importing 7.0.1 settings? Please, test it and create your code templates again...thanks (I think that they will not work either, but...you know ;)
Comment 8 tonanbarbarian 2012-01-06 21:57:09 UTC
I can confirm that even with a fresh install of 7.1 with no imported settings, in a fresh PHP project and a new class file, the code template for my sample public
function code does not work.
fnc works but my_pub does not
Comment 9 dgo 2012-01-09 10:54:47 UTC
(In reply to comment #8)
> I can confirm that even with a fresh install of 7.1 with no imported settings,
> in a fresh PHP project and a new class file, the code template for my sample
> public
> function code does not work.
> fnc works but my_pub does not

I am encountering the same issue
I am running nb 7.1 on Linux Ubuntu 10.04 (64-bit)
Comment 10 dgo 2012-01-09 11:00:21 UTC
(In reply to comment #9)
> (In reply to comment #8)
> > I can confirm that even with a fresh install of 7.1 with no imported settings,
> > in a fresh PHP project and a new class file, the code template for my sample
> > public
> > function code does not work.
> > fnc works but my_pub does not
> 
> I am encountering the same issue
> I am running nb 7.1 on Linux Ubuntu 10.04 (64-bit)

EDIT :
"pf" TAB should create public function() {} 
this does not work within a class{}

however, when doing so within an existing function (or any other code template) functions (although it is not formatted correctly)
Comment 11 activ 2012-01-16 09:29:32 UTC
Hey,

I just want to notice i have same issue on NB7.1 and Windows 7 os.
I've importet code completions from my older installation 7.0.1

Sometimes it works, sometimes not.
Comment 12 wrock 2012-01-18 07:31:10 UTC
Hey,
I also find code templates not workinig on windows 7, netbeans 7.1 (settings imported from 7.0.1) in PHP files. In html-files code completition works fine.
Comment 13 octlabs 2012-01-20 01:44:13 UTC
Hi,

confirm the bug on
NetBeans IDE 7.1 (Build 201112071828)
System: Mac OS X version 10.7.2 running on x86_64;

Some works other not :(

Example
JavaScript 
Abbreviation: d (Tab)
Expanded Text: console.debug(${selection}${cursor});
Comment 14 Ondrej Brejla 2012-01-25 14:14:00 UTC

*** This bug has been marked as a duplicate of bug 206413 ***