Improving Semantic Coloring

Posted by Petr Pisl on Jul 11 2008, 03:02:30 PM CEST

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

Category: Features | Permalink | Comments [13]

Trackback URL: http://blogs.sun.com/netbeansphp/entry/semantic_coloring_improved
Comments:

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.

Posted by Mark on July 11, 2008 at 06:03 PM CEST #

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

Posted by pcdinh on July 11, 2008 at 09:11 PM CEST #

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

Posted by Gerry on July 12, 2008 at 04:27 AM CEST #

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

This looks really cool :-)

Posted by Varun on July 12, 2008 at 10:00 AM CEST #

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

Posted by Anton Heryanto Hasan on July 12, 2008 at 11:42 AM CEST #

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

Petr

Posted by Petr on July 13, 2008 at 03:42 PM CEST #

Hello,

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

example

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
"}"

Posted by raymond on July 21, 2008 at 04:13 PM CEST #

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?

Regards,
Petr

Posted by Petr on July 21, 2008 at 04:45 PM CEST #

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

Posted by Azrael Valedhel on July 22, 2008 at 01:39 AM CEST #

Hi Azrael,

I have entered new enhancement against PHP editor.
http://www.netbeans.org/issues/show_bug.cgi?id=141134

You can add a comment there, if you want.

Thanks,
Petr

Posted by Petr on July 22, 2008 at 12:01 PM CEST #

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

Posted by Azrael Valedhel on July 23, 2008 at 11:58 PM 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 30, 2009 at 03:21 AM CET #

Thanks Petr, I commented it and issued anothed editor little enhancement - which is highlighting single and double quoted strings with their own colors. http://www.gifico.com

Posted by louis vuitton on November 19, 2009 at 06:45 AM CET #

Post a Comment:

Name:
E-Mail:
URL:

Your Comment:

HTML Syntax: NOT allowed