Thursday, March 09, 2006

Variable Prefixes

When writing Java classes I often label my global variables (fields) with a lower case "f" as prefix. This is just to distinguish from local variables while programming and making. Navigating through my preferences dialog the other day I found a nice option that supports this behavior.

Under Java > Code Style you will find a small table to edit prefix and suffix lists for different variable types.

Now when you create a new field and use code completion (ctrl+space) the assistant suggest a variable name starting with whatever prefix you have specified before.

Very nice feature. It would be even more usefull if it let me type a variable name and then suggest adding a prefix when I press ctrl+space.