NetBeans doesn't register my new code template abbreviation

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.

rgvcorley

Posted 2014-08-05T11:30:54.517

Reputation: 355

Answers

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...

Martin

Posted 2014-08-05T11:30:54.517

Reputation: 252