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.
(All methods require that the 'expand tabs to spaces' setting is on under tools > options > editor > formatting ) Method to reproduce # 1: - Open a new php file. - Type fore and press tab. - Sometimes this will cause a foreach loop template to be placed in, other times it will just add a tab. Assuming that it does work: - Delete the code and type fore and hit tab again. - Template isn't generated. Method to reproduce # 2: - Open a php file - Type fore and hit tab. Assuming that it produces the foreach template: - Press enter and type fore and hit tab again. - Template isn't expanded to foreach. Turning off the expand tabs to spaces option fixes this.
This seems to be related to this bug: http://netbeans.org/bugzilla/show_bug.cgi?id=197887 It was marked as fixed, perhaps the fix isn't included in the netbeans download?
Correction, I have the 'Expand spaces to tabs' setting disabled and templates still don't seem to be working for me. So this probably doesn't have anything to do with that setting :(. Please fix this?
Sorry, but I have todays build and it works properly for me in all cases you described. There is just one use case, I think, when code templates are not expanded...if the scanning of sources is in progress. But it can't be simply workarounded since we need the whole parser result to evaluate the right context (to know which templates can be expanded and which can't). Product Version: NetBeans IDE Dev (Build 20120521-4b726a72112f) Java: 1.6.0_26; Java HotSpot(TM) Client VM 20.1-b02 System: Linux version 3.2.0-24-generic-pae running on i386; UTF-8; cs_CZ (nb) User directory: /home/warden/userdir Cache directory: /home/warden/userdir/var/cache
Hi, It sometimes works and other times it doesn't, have you tried at least a few times? Its possible that if you tried it once and it worked, but if you tried it again a few times (especially after deleting the code and saving) then it won't. Otherwise its possible that I don't have the latest build though I installed 7.1.2 a few days ago. Where can I download the latest build?
I tried it many times, because I use the latest NB (7.2dev) for developing of PHP apps. So try that [1]. But I can't do anything with that if I'm not able to reproduce that :( [1] http://bits.netbeans.org/download/trunk/nightly/latest/
Could you try this code: <?php set_time_limit(0); error_reporting(E_ALL); class Test extends BaseController { public function __construct() { parent::__construct(); } public function index() { } } ?> Inside the function, type a template, hit tab. If it works, press enter, hit CTRL + S, then type the abbreviation and hit tab again. Do this at least 2-3 times, when I try this it randomly works and doesn't work for me. Let me know if it still works or not, thanks.
I tried it many times, and the result is as expected. <?php set_time_limit(0); error_reporting(E_ALL); class Test extends BaseController { public function __construct() { parent::__construct(); } public function index() { foreach ($array as $value) { foreach ($array as $value) { foreach ($array as $value) { foreach ($array as $value) { foreach (fore as $value) { foreach ($array as $value) { foreach ($array as $value) { foreach ($array as $value) { } } } } } } } } } } ?> Don't know what to suggest to you... I can better watch the behavior of code templates during my PHP coding, but as I wrote, it works for me properly and I didn't noticed any inconvenience in 7.2 dev.
Hello, Thanks for your help in this. Which operating system are you trying this on? I'm using Windows XP. If I try it with the fore template, it seems to work most of the time for me, however if I try it with a custom template that I added (dbs expanding to $this->db->set() ) then I get this output: <?php set_time_limit(0); error_reporting(E_ALL); class Test extends BaseController { public function __construct() { parent::__construct(); } public function index() { dbs dbs $this->db->set(); dbs dbs dbs dbs $this->db->set(); dbs dbs $this->db->set(); dbs dbs dbs dbs dbs $this->db->set(); } } ?> Culd you may be try that template? Also,have you tested doing CTRL + S after each template, and deleting a template and trying to re insert it in the same place?
Hello, On further testing I've found that if I grab a single php file which is not linked to any project, and I test the same thing, the templates work. However if I add a new file to a project which has 100+ files (using the codeigniter framework) then I get the output as in my last comment. Is there any chance if you could download codeigniter from http://codeigniter.com/downloads/ , add a new project from existing sources and import codeigniter into that, then add a new file to that project, and test the same code as my last comment?
Created attachment 119687 [details] Test project where templates don't work Hello, I've narrowed this problem down, its definitely related to when a file is added to an existing project. If its a single file, then templates work, but in a project, they don't. For your convenience I'm attaching a .zip of a test project I just created to test this. If you open controllers/test.php and test the dbs template in there (expanding to $this->db->set() ) then it should likely reproduce the bug for you. Just extract the zip and then in netbeans, do 'File -> Open project' and point to the directory where you extracted. Thanks again for your help.
I'll try it, thanks.
Have you tried the dev build 7.2? I put here a link. http://bits.netbeans.org/download/trunk/nightly/latest/
I don't think I have to because the templates are working for me if I test on a file not linked to a project. If they work for you in the test project I sent, then I'll download and try it.
The file to test it in is application/controllers/test.php
I tried it right now and it work for me properly with both "expand tabs" (which has nothing to do with invoking code templates AFAIK) settings...and with your type of custom code template in your CodeIgniter_2.1.0 project. No problem at all. Sorry.
ok, i will try installing the version you linked
Don't forget to DO NOT IMPORT old NB settings...make a pure clean instalation.
will do
Hello, I've downloaded and installed the version you linked, but I get this error when I try to run it: http://i45.tinypic.com/12172q1.png I've checked that the folder netbeans/dev on that path exists but still the same error. Any ideas? Should I just do a pure re-install from http://netbeans.org/downloads/index.html ?
The development version should create its own user directory. And it has been created since you have a "dev" directory there. Try to delete it and reinstal that Dev version. It should work without any problem. Really don't know why it complains. Or you can try this one: http://bertram2.netbeans.org:8080/job/PHP-build/lastSuccessfulBuild/artifact/nbbuild/NetBeans-dev-2012-05-21_06-03-55%20-php.zip
Deleted the dev directory and reinstalled, same issue. How about I download the stable 7.1.2 again and do a pure install?
I tried a clean install of 7.1.2 but it doesn't work in that either. downloaded the .zip you linked but it seems to have the source code and not an installer.
Sorry, but I need a response from your use of 7.2, not 7.1.2. But I still can't reproduce that. Yes, that zip is not installable, you can just run the sources. Vlado, can you reproduce that with a 7.2dev on Windows? Thanks. Please, let the status be, until Vlada tries that on win and writes some conclusion. Thanks.
I don't think I can run that version because of the bug that pops up regarding the dev folder.
Sorry, cannot reproduce it. The only possible situation when the template is not expanded is if you type "fore" and wait a while so the code completion window appears and atfer that simple "foreach" is completed from CC instead of expanding template. And this seems OK to me. Custom template also works for me. Product Version: NetBeans IDE Dev (Build 201205200400) Java: 1.7.0_04; Java HotSpot(TM) Client VM 23.0-b21 System: Windows 7 version 6.1 running on x86; Cp1252; en_US (nb)
Thanks.
Guys, any chance you could try that on windows XP?
So I checked WindowsXP and it also works fine, sorry Product Version: NetBeans IDE Dev (Build 201206120719) Java: 1.6.0_26; Java HotSpot(TM) Client VM 20.1-b02 System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
I'm running Windows 7x64 and having problems with code templates also. I've upgraded from netbeans 6.9 to 7.2 an code templates don't work as they used to. They work with html file, but don't work with css and js files. I've imported all my defaults from Netbeans 6.9 as I've made tons of code templates for front-end web developmentand don't have time to rewrite from scratch. I've tried files from php project and also standalone files. The problem appears in both of them.
I've found out the problem. ${selection} reserved name doesn't work in netbeans 7.2 When I remove ${selection} everything works as before.
Don't reopen this issue if code templates for JS and HTML don't work for you. It's not handled by php. File new issues for JS. And upgrade from 6.9 to 7.2 is not supported afaik. Only upgrade from one previous version to new one is supperted. Try it with a clean install and fresh userdir. Lado, can you confirm such a problems?
Ok, sorry. In php code templates ${selection} works properly
${selection} works for me too, I'll try the upgrade scenario as Ondra said, only 1 version back is supported, so 7.1