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 246664 - Custom Code Templates and Code Completion for PHP
Summary: Custom Code Templates and Code Completion for PHP
Status: RESOLVED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.0
Hardware: All All
: P3 normal (vote)
Assignee: Tomas Mysik
URL:
Keywords:
: 256553 257229 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-08-24 15:12 UTC by edutrul
Modified: 2016-01-23 05:56 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
patch (1.34 KB, patch)
2015-11-13 10:18 UTC, junichi11
Details | Diff
screenshot (options) (48.40 KB, image/png)
2015-11-13 10:29 UTC, junichi11
Details

Note You need to log in before you can comment on or make changes to this bug.
Description edutrul 2014-08-24 15:12:52 UTC
The issue:

NB code templates at /Tools/Options/Editor/Code Templates gives use predefined templates and the option for creating 
custom ones. 

Now reproduce as follows:

1. Open /Tools/Options/Editor/Code Templates
2. Set Language to PHP
3. Click New
4. Type "mytemplate" as abbreviation
5. Click OK
6. Type "This is my template text" in the Expanded Text tab
7. Click OK at the bottom of the window
8. Back in the editor delete the typed "for" from the method body
9. Type "mytemplate" and invoke the code completion "Ctrl+Space"

What we get is "No suggestions". Sigh :-( 

What I expected was the same behavior as for the built-in templates. For me it also does not make much sens to have a 
hugh stack of custom code templates and have to remember each and every abbreviation to be able to expand it with TAB 
or whatever. Because please reproduce as follows:

1. Delete the typed "mytemplate" from the method body
2. Retype "mytemplate" and press "TAB"

What we get is "This is my template text". This shows us that the IDE is perfectly aware of the custom code templates 
but for some reason the code completion is not.

(this was resolved in https://netbeans.org/bugzilla/show_bug.cgi?id=160771#c14 for java) But not for PHP)

Please, I would really appreacite if this is done for PHP as well. Since We as developers use a lot code completion.

Thanks a lot
best regards
Comment 1 Tomas Mysik 2014-08-25 05:38:15 UTC
More a bug if the API already exists and it is used in Java - Ondro, please evaulate, thanks.

Thanks for reporting.
Comment 2 junichi11 2015-11-13 10:18:31 UTC
Created attachment 157320 [details]
patch

I've created a patch.
Comment 3 junichi11 2015-11-13 10:29:13 UTC
Created attachment 157321 [details]
screenshot (options)

A custom code template will be shown in the CC popup if you check the "php-code" in the Contexts tab.
Comment 4 junichi11 2015-11-13 10:35:04 UTC
Tomas, Because "php-code" is used as contexts in the default templates file, I just used it.

Thanks.
Comment 5 Tomas Mysik 2015-11-13 10:38:14 UTC
Will try to get to your patches ASAP, sorry I am quite busy now :/. Likely till the end of the next week.

Thanks for understanding.
Comment 6 junichi11 2015-11-13 10:47:44 UTC
(In reply to Tomas Mysik from comment #5)
> Will try to get to your patches ASAP, sorry I am quite busy now :/. Likely
> till the end of the next week.

Anytime is OK for me :)
Comment 7 junichi11 2015-11-13 10:48:43 UTC
*** Bug 256553 has been marked as a duplicate of this bug. ***
Comment 8 riksoft 2015-11-13 12:18:58 UTC
Please take note that as I wrote here
https://netbeans.org/bugzilla/show_bug.cgi?id=256553
the problem is not only about PHP, it involves also the other web related languages, such as HTML, JS, etc.
Comment 9 junichi11 2015-11-13 12:24:39 UTC
(In reply to riksoft from comment #8)
> Please take note that as I wrote here
> https://netbeans.org/bugzilla/show_bug.cgi?id=256553
> the problem is not only about PHP, it involves also the other web related
> languages, such as HTML, JS, etc.

Probably, you should report it to each language support. Thanks.
Comment 10 riksoft 2015-11-13 17:38:38 UTC
OK, I've changed the scope from product PHP to Editor and Component="Complations & Templates".
Thanks.
Comment 11 junichi11 2015-11-13 21:31:26 UTC
(In reply to riksoft from comment #10)
> OK, I've changed the scope from product PHP to Editor and
> Component="Complations & Templates".

Sorry, please don't change to it. Just submit to __each language__(e.g. Html editor, javascript editor,...) as a new issue.
Because this feature already exists in the editor area, each language support has to implement it.

Thanks.
Comment 12 junichi11 2015-11-13 21:35:06 UTC
*** Bug 256553 has been marked as a duplicate of this bug. ***
Comment 13 Tomas Mysik 2015-11-20 09:43:23 UTC
Patch applied, thanks a lot for it, Junichi! The only change I made was to set proper library version to be used.

http://hg.netbeans.org/web-main/rev/f4f5bd9b01f1
Comment 14 Quality Engineering 2015-11-21 03:05:29 UTC
Integrated into 'main-silver', will be available in build *201511210002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/f4f5bd9b01f1
User: Tomas Mysik <tmysik@netbeans.org>
Log: #246664 - Custom Code Templates and Code Completion for PHP

Patch contributed by junichi11@netbeans.org.
Comment 16 junichi11 2016-01-23 05:56:41 UTC
*** Bug 257229 has been marked as a duplicate of this bug. ***