Jun 4 2009

I’ve started giving Netbeans for PHP a try, considering everyone is saying how much better it is than Eclipse PDT. So far I’m very impressed at it’s simplicity and ease of use – which for the main tool a programmer uses day in an day out for at least 8 hours, is a very good thing.

However I came across a couple of “issues” or teething problems rather, that thankfully with a short Google (sorry Bing…), I managed to find solutions for…

Delaying the Code Completion Pop-up

Here at Netbasic towers, we have very big projects. The main project I work with has nearly 5,000 files, most of which are classes, and our custom framework has around 500 files, again mostly consisting of classes. Can you tell we love OOP PHP? Anyhow, this makes Netbeans run a little slow when loading the code completion pop-up. In Eclipse PDT, there is the option to delay the appearance of the code completion so it only appears if you’re stuck. In Netbeans I could not find such an option, and my only option appeared to be turn of auto appearing the pop-up, thus forcing me to Ctrl+Space every time I wanted code completion. This is a little niggle, but there is a solution for it:

As a workaround in the file:
%USERPROFILE%/.netbeans/6.5/config/Editors/text/x-java/Preferences/org-netbeans-modules-editor-settings-CustomPreferences.xml

The value completion-auto-popup-delay can be set manually.

Source: http://www.netbeans.org/issues/show_bug.cgi?id=124540

Tabs versus Spaces for Indentation

We use tabs at Netbasic, and using tabs is my preference over using 4 or another number of spaces. Despite how simple the interface is for Netbeans, it’s a little confusing. The reason is because it’s actually aimed towards Java developers. Read this and comprehend it, and it might just help you figure out how to use tabs instead of spaces…

Four spaces should be used as the unit of indentation. The exact construction of the indentation (spaces vs. tabs) is unspecified. Tabs must be set exactly every 8 spaces (not 4).

Source: http://java.sun.com/docs/codeconv/html/CodeConventions.doc3.html#262

Basically what you have to do is set the “Exand Tabs to Spaces” off, and set the “Tab Size” to 4.

Credit goes to Al’s Blog for that one. And the issue for it: http://www.netbeans.org/issues/show_bug.cgi?id=52053

With these couple of things out the way (which were show-stoppers for us using Netbeans at Netbasic), I can continue using Netbeans for now and hopefully recommend that we switch from Eclipse PDT! :)

One Response to “Netbeans – A Couple of Pointers”

  1. php|hampshire » Code Completion and Tabbed Indentation in Netbeans says:

    [...] Titcumb recently started trying out Netbeans, but had a couple of teething issues. He found simple solutions to his problems, which were adding a delay before the code completion [...]

Leave a Reply