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.
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
More a bug if the API already exists and it is used in Java - Ondro, please evaulate, thanks. Thanks for reporting.
Created attachment 157320 [details] patch I've created a patch.
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.
Tomas, Because "php-code" is used as contexts in the default templates file, I just used it. Thanks.
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.
(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 :)
*** Bug 256553 has been marked as a duplicate of this bug. ***
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.
(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.
OK, I've changed the scope from product PHP to Editor and Component="Complations & Templates". Thanks.
(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.
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
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.
I blogged about it: https://benkiew.wordpress.com/2016/01/07/quicktip-how-to-display-your-own-php-code-templates-in-the-code-completion-of-netbeans-ide/
*** Bug 257229 has been marked as a duplicate of this bug. ***