An Oracle blog about NetBeans for PHP

Improving Semantic Coloring

I have improved the semantic coloring in the PHP editor this week. In this case one picture is much better then many words.

Join the discussion

Comments ( 15 )
  • Mark Friday, July 11, 2008

    Sweet. I would only change a few things.

    - Line 5: The unused field's name should be green like the other fields, but still with the gray squiggle underlining it.

    - Line 15: The unused method's name should be bold like the other methods, but still with the gray squiggle underlining it.

    - Line 23: The static method's name should be italicized.

    - Throughout: Maybe treat $this like a keyword and color it blue. Eh, maybe not.

  • pcdinh Friday, July 11, 2008

    I actually don't like to the way class declaration is aligned, compared to <?php column. This is not PHP way at all. The class keyword should be aligned in the same column as in <?php line

  • Gerry Friday, July 11, 2008

    I agree with mark, also i'd suggest that the squiggles have some attention getting colors which indicate severity (ie warnings, errors, info)

    Can the "<?php ?>" pair be something like red so that its easy to see when mixed with html to sort of let you know the boundaries of where the code starts and ends

  • Varun Saturday, July 12, 2008

    What OS and Look & Feel you are using for NetBeans Build?

    This looks really cool :-)

  • Anton Heryanto Hasan Saturday, July 12, 2008

    I agree with pcdinh, i would like php code align in same column as <?php .. is there anyway to configure ?

  • Petr Sunday, July 13, 2008

    Thanks to all for the comments. I have wrote new entry http://blogs.sun.com/netbeansphp/entry/improving_semantic_coloring_continue , where I reflect every comment for this entry.

    To Varun: I use Ubuntu 8.04, Gnome. I changed a little the standard theme (Controls: Industrial, Window Border: Mist).


  • raymond Monday, July 21, 2008


    How about highlighting the parenthesis then the cursor place between them?


    function "("$name,$age|,$color")" {}

    // when cursor is inside represented by "|" then

    // the outer brackets will be highlighted represented by "(" and ")"

    The same can be applied for {} brackets

    function ($name,$age,$color) "{"

    // some code here

    $name[] = $name;| // <- cursor here


  • Petr Monday, July 21, 2008

    Hi Raymond,

    there is functionality, which highlights the parenthesis. It doesn't work as you describe, but when you place cursor after ( or ) in your case then the opposite bracket is highlighted. The same is for { } and [].

    Also what I use very often is CTRL+[ shortcut, which jumps just after the opposite bracket. With SHIFT combination, it selects the content beetween the brackets. Does it work for you?



  • Azrael Valedhel Monday, July 21, 2008

    It would be nice to add highlighting whole ()?():() block (I mean the three brackets pairs of the "current" block) like in this example

    function fWhatever ($a, $b) {

    return ($a > $b)?(($a < $b)?($a-$b):($b-$a)):(($a == 2)?($b):("("$a == $b")"?"("$a")":"("$b|")"));


    // | == cursor position, "(" && ")" == highlighted brackets

    I tent to use short ifs and it would help a lot in codes that require more complexity. :)

    Also higlighting the brackets in a way raymond wrote would add another aspeckt of usefulness ;)

    It would be "I always know where I am" - without searching those brackets to place cursor after them and see which one is yellow/(w/e color suits you ;) )

  • Petr Tuesday, July 22, 2008

    Hi Azrael,

    I have entered new enhancement against PHP editor.


    You can add a comment there, if you want.



  • Azrael Valedhel Wednesday, July 23, 2008

    Thanks Petr, I commented it and issued anothed editor little enhancement - which is highlighting single and double quoted strings with their own colors. It can be found here:


  • links of london Thursday, October 29, 2009

    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.

  • Olivea32 Wednesday, July 7, 2010

    A four year old little boy was at the doctor's office with his mother in the waiting room when he spotted a pregnant lady on the other side of the room. Having nothing better to do, he walks over to her and inquisitively asks "Why is your stomach so big?"

  • Mark Wednesday, July 7, 2010

    Here's hoping that by posting a new comment with "notify" unchecked, I will stop getting these spam comments as spam email.

  • Mark Wednesday, July 7, 2010

    Attempt #2.

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.