2

I am using the latest version of NetBeans (8.0), and I am trying to add my own code templates (Tool -> Options -> Editor -> Code Templates -> New

I have created a new PHP code template with abbreviation mn. I click apply, and then when I go to edit my php file, the abbreviation does not bring up the code template. However, if I type one of the pre-defined abbreviations, then it works fine.

I have tried closing the PHP file and re-opening it. I have tried restarting the IDE, and I have also tried exporting and importing the code templates. Nothing will make my new abbreviation work.

0

This answer comes too late, but maybe this solution is useful for new users with the problem "netbeans code template not working" in newer versions

C:\Users\{yourUser}\AppData\Roaming\NetBeans\8.1\config\Editors\text\x-php5\CodeTemplates\org-netbeans-modules-editor-settings-CustomCodeTemplates.xml

and add this:

contexts="php-code"

in all codetemplate like this:

<codetemplate abbreviation="{YourAbrebiation}" contexts="php-code" xml:space="preserve">

restart your IDE after that and your new template will work perfectly...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.