Improving Semantic Coloring ... updated based on your comments

On base of the comments for my previous entry Improving Semantic Coloring, I have update the semantic coloring. You can see the result at the picture.

 Based on Mark's comment I have updated:

  • coloring of unused private class fields (line 5)
  • coloring of unused private method (line 16)
  • coloring of static method name (line 24)
  • coloring of unused private static method (line 28)

Pcdinh and Anton mentioned that the PHP code should be aligned in same column as <?php open tag. I agree and I have corrected our formating engine. Unfortunately the formatter doesn't have a UI to change the default settings so far.

Gerry mentioned color of the "<?php  ?>" pair. I think that the suggested red color is suitable for expressing that something is wrong. I haven't changed the current default color, but everybody can change it simply through Fonts & Colors settings. If you want to change it, go to Tools->Options->Fonts & Colors. In Syntax tab select PHP in Language combobox and in Category select PHP Open/Close Tag item. Now you can change the appearance of the "<?php  ?>" pair. 


thank for good response to community.
i just wanna know whether code completion will available for variable assigned object in this sample $result:

$conn = new mysqli($host, $user, $pass, $db);
$result = $conn->query("SELECT \* FROM db");
$result->fetch_object //code completion

currently it not supported, also simple object assigned to other variable:
$person = new Person();
$person = $anotherPerson;
$anotherPerson-> //not have code completion

anyway thank for good product :D

Posted by Anton Heryanto Hasan on July 13, 2008 at 10:38 AM CEST #

This is quite nice, I 'll start using it right away and see how it goes.
@Anthon, the code completion thing is very important, I've seen great code completion while using Zend's platform and I think its a must for all objects, however that example above does not initialize the '$anotherperson' as an object but references it as a new variable, with no value.

Posted by Segun on July 13, 2008 at 09:22 PM CEST #

Wow! Thanks for taking our suggestions into consideration. That's one thing the NetBeans devs have all been really good about, and we all really appreciate it.

This is amazing.

Posted by Mark on July 14, 2008 at 04:26 PM CEST #

I'm using nb build 20080710 and i can't find a way to align my code with <?php tag. Is a default option or i need to do something ?

Posted by Giuliani Sanches on July 15, 2008 at 06:47 PM CEST #

@Giuliani Sanches

You may want to check the following link to get the latest build:

Posted by pcdinh on July 16, 2008 at 01:41 AM CEST #


I was waiting for a long time Netbeans to offer a good PHP support. Now it's there and it's great !

By the way, there is still some "bugs" or "misergonomic features" (sorry for my english). I'll try to explain what I found a little bit strange (according to the fact that all the remaining is just awesome !)

First of all:
- I use the 2008-08-15_18-31-38 snapshot.
- I have built a PHP project from existing sources and set up php include path to load some others file (zend framework, etc.)

Encountered problems:
- Navigate > Go to declaration never works. It just "compute" for a time, and then I hear an error sound from windows.
- With this syntax :
I don't have auto-completion with the methods of MyClass. By the way, I have set the @return attribute in the getInstance() method to "MyClass".
- The autocompletion on variables seems a bit strange. It doesn't suggest the variables I just created in the preceding line.

That's it for now. Great job !

Posted by Joel on August 15, 2008 at 05:41 PM CEST #

Hi Joel,

> - Navigate > Go to declaration never works. It
>just "compute" for a time, and then I hear an
>error sound from windows.

I know about this problem and I'm trying to fix it. .

>I don't have auto-completion with the methods of
> MyClass. By the way, I have set the @return
> attribute in the getInstance() method to
> "MyClass".

I have entered issue about this. . Just check, whether this is what you mean.

> The autocompletion on variables seems a bit
>strange. It doesn't suggest the variables I just
>created in the preceding line.

I can not reproduce this. Do you have reproducible case? It looks like a random issue, but still it should be fixed.


Posted by Petr on August 16, 2008 at 06:20 AM CEST #

Is it possible to setup color scheme for static variable same as for normal variable, without changing the static method scheme?. I used to color variable is a variable, without any parameters to it (like static) and now I am a little confiused...

Posted by menic on December 07, 2008 at 01:59 PM CET #

Hi Menic,

I'm afraid that this is not possible, because variable and methods use the same Static element color style definition, which altered the inherited style.


Posted by Petr on December 07, 2008 at 03:40 PM CET #

Wow, this article is great! I was confused about syntax coloring because I didn't realize I had to go to the 'php' section of the color settings to change some things. I'll go remove a bug i reported that was just me being stupid!

Posted by Jeremy Clarke on July 31, 2009 at 11:30 AM CEST #

It was a very nice idea! Just wanna say thank you for the information you have shared. Just continue writing this kind of post. I will be your loyal reader. Thanks again.

Posted by links of london on October 29, 2009 at 08:26 PM CET #

Post a Comment:
  • HTML Syntax: NOT allowed

This blogs is written by NetBeans developers who contribute to the PHP support mainly.


« June 2016