X

An Oracle blog about NetBeans for PHP

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. 


Join the discussion

Comments ( 11 )
  • Anton Heryanto Hasan Sunday, July 13, 2008

    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);

    $conn->connect();

    $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->name;

    $person = $anotherPerson;

    $anotherPerson-> //not have code completion

    anyway thank for good product :D


  • Segun Sunday, July 13, 2008

    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.


  • Mark Monday, July 14, 2008

    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.


  • Giuliani Sanches Tuesday, July 15, 2008

    Hi

    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 ?


  • pcdinh Tuesday, July 15, 2008

    @Giuliani Sanches

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

    http://deadlock.netbeans.org/hudson/job/PHP-build/lastSuccessfulBuild/


  • Joel Friday, August 15, 2008

    Hi,

    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 :

    MyClass::getInstance()->

    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 !


  • Petr Saturday, August 16, 2008

    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. http://www.netbeans.org/issues/show_bug.cgi?id=143426 .

    >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.

    http://www.netbeans.org/issues/show_bug.cgi?id=144161 . 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.

    Thanks,

    Petr


  • menic Sunday, December 7, 2008

    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...


  • Petr Sunday, December 7, 2008

    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.

    Regards,

    Petr


  • Jeremy Clarke Friday, July 31, 2009

    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!


  • 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.


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