jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • GRECLIPSE
  • GRECLIPSE-924

Additional coloring options for syntax highlighting

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Improvement Improvement
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 2.1.0Release
  • Fix Version/s: None
  • Component/s: Editor
  • Labels:
    • wish

Description

Is it possible to add Class (e.g. String, Integer, File), Background,
LineNumber and MethodName coloring to Preferences > Groovy > Editor?

I'd really like to see my Groovy code highlighted in color themes like
Vibrant Ink (from TextMate).

The Visual Studio people have a website (http://studiostyl.es/) with
color schemes.

Color themes in Eclipse are possible by coping configuration files
of the workspace (.metadata\.plugins\org.eclipse.core.runtime\.settings).

See: http://stackoverflow.com/questions/96981/color-themes-for-eclipse

Having at least an option to change Class and Background color would
be nice!

--Benjamin

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. colors-20101231.png
    58 kB
    17/Jan/11 10:14 AM
  2. javaandgroovy.png
    37 kB
    08/Dec/10 5:57 AM

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Benjamin Gudehus added a comment - 07/Dec/10 4:25 PM - edited

Convert the Visual Studio style wekeroad-ink.vssettings
(http://studiostyl.es/schemes/wekeroad-ink) into a groovy eclipse coloring "theme".

First filter the required color values from wekeroad-ink.vssettings:

<Item Name="Comment" Foreground="0x00808080" Background="0x02000000" BoldFont="No"/>
<Item Name="Plain Text" Foreground="0x00FFFFFF" Background="0x00000000" BoldFont="No"/>
<Item Name="Identifier" Foreground="0x02000000" Background="0x02000000" BoldFont="No"/>
<Item Name="Number" Foreground="0x02000000" Background="0x02000000" BoldFont="No"/>
<Item Name="Operator" Foreground="0x02000000" Background="0x02000000" BoldFont="No"/>
<Item Name="String" Foreground="0x005CC2A5" Background="0x02000000" BoldFont="No"/>
<Item Name="User Types" Foreground="0x006DC6FF" Background="0x02000000" BoldFont="No"/>
<Item Name="Line Numbers" Foreground="0x00AF912B" Background="0x00000000" BoldFont="No"/>
<Item Name="Keyword" Foreground="0x003278CC" Background="0x02000000" BoldFont="No"/>

I would translate them into something like this:

plaintext = #FFFFFF (Plain Text)
background = #000000 (Plain Text / Background)
linenumber = #AF912B (Line Numbers)
keyword = #3278CC (Keyword)
usertype = #6DC6FF (User Types)
comment = #808080 (Comment)
multilinecomment = #808080 (Comment)
string = #5CC2A5 (String)
number = #000000 (Number)
identifier = #000000 (Identifier)
operator = #000000 (Operator)

And finally add the color values as rgb values into
org.codehaus.groovy.eclipse.ui.prefs (<variables> exchanged by rbg values).
(Key-Value-Pairs are in the same order as in the dialog).

groovy.editor.highlight.gjdk.color=<identifier>
groovy.editor.highlight.groovykeywords.color=<keyword>
groovy.editor.highlight.multilinecomments.color=<comment>
groovy.editor.highlight.javatypes.color=<keyword>
groovy.editor.highlight.javakeywords.color=<keyword>
groovy.editor.highlight.strings.color=<string>
groovy.editor.highlight.numbers.color=<number>
groovy.editor.groovyDoc.keyword.color=<comment>
groovy.editor.groovyDoc.link.color=<comment>
groovy.editor.groovyDoc.tag.color=<comment>
groovy.editor.highlight.default.color=<plaintext>

These additional configuration options are required:

groovy.editor.highlight.usertypes.color=<usertype>
groovy.editor.highlight.operators.color=<operator>
groovy.editor.highlight.identifiers.color=<identifier>
groovy.editor.highlight.comments.color=<comment>
groovy.editor.highlight.background.color=<background>
groovy.editor.highlight.linenumbers.color=<linenumber>

usertypes is our class coloring and identifiers are methods and variable names.

Show
Benjamin Gudehus added a comment - 07/Dec/10 4:25 PM - edited Convert the Visual Studio style wekeroad-ink.vssettings (http://studiostyl.es/schemes/wekeroad-ink) into a groovy eclipse coloring "theme". First filter the required color values from wekeroad-ink.vssettings:
<Item Name="Comment" Foreground="0x00808080" Background="0x02000000" BoldFont="No"/>
<Item Name="Plain Text" Foreground="0x00FFFFFF" Background="0x00000000" BoldFont="No"/>
<Item Name="Identifier" Foreground="0x02000000" Background="0x02000000" BoldFont="No"/>
<Item Name="Number" Foreground="0x02000000" Background="0x02000000" BoldFont="No"/>
<Item Name="Operator" Foreground="0x02000000" Background="0x02000000" BoldFont="No"/>
<Item Name="String" Foreground="0x005CC2A5" Background="0x02000000" BoldFont="No"/>
<Item Name="User Types" Foreground="0x006DC6FF" Background="0x02000000" BoldFont="No"/>
<Item Name="Line Numbers" Foreground="0x00AF912B" Background="0x00000000" BoldFont="No"/>
<Item Name="Keyword" Foreground="0x003278CC" Background="0x02000000" BoldFont="No"/>
I would translate them into something like this:
plaintext = #FFFFFF (Plain Text)
background = #000000 (Plain Text / Background)
linenumber = #AF912B (Line Numbers)
keyword = #3278CC (Keyword)
usertype = #6DC6FF (User Types)
comment = #808080 (Comment)
multilinecomment = #808080 (Comment)
string = #5CC2A5 (String)
number = #000000 (Number)
identifier = #000000 (Identifier)
operator = #000000 (Operator)
And finally add the color values as rgb values into org.codehaus.groovy.eclipse.ui.prefs (<variables> exchanged by rbg values). (Key-Value-Pairs are in the same order as in the dialog).
groovy.editor.highlight.gjdk.color=<identifier>
groovy.editor.highlight.groovykeywords.color=<keyword>
groovy.editor.highlight.multilinecomments.color=<comment>
groovy.editor.highlight.javatypes.color=<keyword>
groovy.editor.highlight.javakeywords.color=<keyword>
groovy.editor.highlight.strings.color=<string>
groovy.editor.highlight.numbers.color=<number>
groovy.editor.groovyDoc.keyword.color=<comment>
groovy.editor.groovyDoc.link.color=<comment>
groovy.editor.groovyDoc.tag.color=<comment>
groovy.editor.highlight.default.color=<plaintext>
These additional configuration options are required:
groovy.editor.highlight.usertypes.color=<usertype>
groovy.editor.highlight.operators.color=<operator>
groovy.editor.highlight.identifiers.color=<identifier>
groovy.editor.highlight.comments.color=<comment>
groovy.editor.highlight.background.color=<background>
groovy.editor.highlight.linenumbers.color=<linenumber>
usertypes is our class coloring and identifiers are methods and variable names.
Hide
Permalink
Andrew Eisenberg added a comment - 07/Dec/10 4:42 PM

Some coloring and font preferences are borrowed from the Java editor, for example, background color, font, line number background highlighting.

Field highlighting is a recent addition in 2.1.1, and it, too borrows from the Java settings. I have not added method or class coloring, but could.

If I understand correctly, the actual missing features here are class and method coloring. Is that correct?

Show
Andrew Eisenberg added a comment - 07/Dec/10 4:42 PM Some coloring and font preferences are borrowed from the Java editor, for example, background color, font, line number background highlighting. Field highlighting is a recent addition in 2.1.1, and it, too borrows from the Java settings. I have not added method or class coloring, but could. If I understand correctly, the actual missing features here are class and method coloring. Is that correct?
Hide
Permalink
Benjamin Gudehus added a comment - 07/Dec/10 4:46 PM - edited

I finally came up with this org.codehaus.groovy.eclipse.ui.prefs:

#Tue Dec 07 23:36:39 CET 2010
eclipse.preferences.version=1
groovy.semantic.highlighting=false
groovy.debug.force_options=false
groovy.debug.filter.list=groovy.lang,groovy.ui,java.lang.reflect,org.codehaus.groovy,sun.misc,sun.reflect
groovy.junit.monospace.font=true

groovy.editor.highlight.gjdk.color=255,255,255
groovy.editor.highlight.groovykeywords.color=204,120,50
groovy.editor.highlight.multilinecomments.color=128,128,128
groovy.editor.highlight.javatypes.color=204,120,50
groovy.editor.highlight.javakeywords.color=204,120,50
groovy.editor.highlight.strings.color=165,194,92
groovy.editor.highlight.numbers.color=255,255,255
groovy.editor.groovyDoc.keyword.color=128,128,128
groovy.editor.groovyDoc.link.color=128,128,128
groovy.editor.groovyDoc.tag.color=128,128,128
groovy.editor.highlight.default.color=255,255,255

groovy.editor.highlight.usertype.color=255,198,109
groovy.editor.highlight.operators.color=255,255,255
groovy.editor.highlight.identifiers.color=255,255,255
groovy.editor.highlight.comments.color=128,128,128
groovy.editor.highlight.background.color=0,0,0
groovy.editor.highlight.linenumbers.color=43,145,175

Weird: Foreground="0x00AF912B" are the values for alpha, blue, green in red (in this order).

Show
Benjamin Gudehus added a comment - 07/Dec/10 4:46 PM - edited I finally came up with this org.codehaus.groovy.eclipse.ui.prefs:
#Tue Dec 07 23:36:39 CET 2010
eclipse.preferences.version=1
groovy.semantic.highlighting=false
groovy.debug.force_options=false
groovy.debug.filter.list=groovy.lang,groovy.ui,java.lang.reflect,org.codehaus.groovy,sun.misc,sun.reflect
groovy.junit.monospace.font=true

groovy.editor.highlight.gjdk.color=255,255,255
groovy.editor.highlight.groovykeywords.color=204,120,50
groovy.editor.highlight.multilinecomments.color=128,128,128
groovy.editor.highlight.javatypes.color=204,120,50
groovy.editor.highlight.javakeywords.color=204,120,50
groovy.editor.highlight.strings.color=165,194,92
groovy.editor.highlight.numbers.color=255,255,255
groovy.editor.groovyDoc.keyword.color=128,128,128
groovy.editor.groovyDoc.link.color=128,128,128
groovy.editor.groovyDoc.tag.color=128,128,128
groovy.editor.highlight.default.color=255,255,255

groovy.editor.highlight.usertype.color=255,198,109
groovy.editor.highlight.operators.color=255,255,255
groovy.editor.highlight.identifiers.color=255,255,255
groovy.editor.highlight.comments.color=128,128,128
groovy.editor.highlight.background.color=0,0,0
groovy.editor.highlight.linenumbers.color=43,145,175
Weird: Foreground="0x00AF912B" are the values for alpha, blue, green in red (in this order).
Hide
Permalink
Benjamin Gudehus added a comment - 07/Dec/10 4:52 PM - edited

@Andrew: Class (usertypes) and method (identifier) coloring are missing, this is correct.

Distingish between field and method (which are both identifier in vstudio) is a good idea.

Would also be nice to have a coloring for operators (if not already borrowed from java editor).

Show
Benjamin Gudehus added a comment - 07/Dec/10 4:52 PM - edited @Andrew: Class (usertypes) and method (identifier) coloring are missing, this is correct. Distingish between field and method (which are both identifier in vstudio) is a good idea. Would also be nice to have a coloring for operators (if not already borrowed from java editor).
Hide
Permalink
Benjamin Gudehus added a comment - 08/Dec/10 5:57 AM

I've added javaandgroovy.png which shows coloring of Java code in a .java file on the top and coloring of Java code in a .groovy file on the bottom.

General > Editors > Text Editors has Foreground color set as green. Java overrides chars like "(" and "{" with other colors, Groovy, instead, uses the green color for them.

I've used a darker color theme since the differences are more obvouis to spot.

Theme is vibrantink from http://stackoverflow.com/questions/96981/color-themes-for-eclipse/1248204#1248204

Show
Benjamin Gudehus added a comment - 08/Dec/10 5:57 AM I've added javaandgroovy.png which shows coloring of Java code in a .java file on the top and coloring of Java code in a .groovy file on the bottom. General > Editors > Text Editors has Foreground color set as green. Java overrides chars like "(" and "{" with other colors, Groovy, instead, uses the green color for them. I've used a darker color theme since the differences are more obvouis to spot. Theme is vibrantink from http://stackoverflow.com/questions/96981/color-themes-for-eclipse/1248204#1248204
Hide
Permalink
Andrew Eisenberg added a comment - 08/Dec/10 10:39 AM

Thanks for the screenshot. I take this to mean that you would like your groovy files to be able to look exactly like that java file?

Show
Andrew Eisenberg added a comment - 08/Dec/10 10:39 AM Thanks for the screenshot. I take this to mean that you would like your groovy files to be able to look exactly like that java file?
Hide
Permalink
Benjamin Gudehus added a comment - 08/Dec/10 2:46 PM - edited

Yes, the coloring for groovy files should resemble the color settings one has made under Java > Editor, Java > Editor > Syntax Coloring and General > Editors > Text Editors. That's the BIG point.

Maybe an JLabel on the top of Groovy > Editor stating "Java colors can be configured on the <Java Syntax Coloring> preference page." linking to Java > Editor > Syntax Coloring could be added.

Another point: Currently Groovy > Editor contains some additional color settings, since groovy adds some more syntactical features (GJDK method, Groovy keyword). The other color settings can be copied from java color preferences using the "Copy Java Color Preferences" button.

I've tried to find out, which color setting is for which syntactical feature:

  • GJDK method (it, any, collect, getText, ...)
  • Groovy keyword (def, assert, ...)
  • Multi-line comment (//)
  • Java types (interface, class, ...)
  • Java keyword (enum, package, import, extends, new, for, if, while, switch, case)

Java types and Java keyword could maybe coerced to Java keyword and Multi-line comment could be dropped in favor of using the multi-line comment setting from java color prefs. BTW: Multi-line comment colors comments with //, that's obviously wrong. And why is "enum" under Java keyword?

The "Copy Java Color Prefs" button could set the colors for GJDK method (using the method setting from java) and Groovy keyword (using the keyword setting from java). GJDK method coloring should only color methods and "it" could be moved to Groovy keyword.

Show
Benjamin Gudehus added a comment - 08/Dec/10 2:46 PM - edited Yes, the coloring for groovy files should resemble the color settings one has made under Java > Editor, Java > Editor > Syntax Coloring and General > Editors > Text Editors. That's the BIG point. Maybe an JLabel on the top of Groovy > Editor stating "Java colors can be configured on the <Java Syntax Coloring> preference page." linking to Java > Editor > Syntax Coloring could be added. Another point: Currently Groovy > Editor contains some additional color settings, since groovy adds some more syntactical features (GJDK method, Groovy keyword). The other color settings can be copied from java color preferences using the "Copy Java Color Preferences" button. I've tried to find out, which color setting is for which syntactical feature:
  • GJDK method (it, any, collect, getText, ...)
  • Groovy keyword (def, assert, ...)
  • Multi-line comment (//)
  • Java types (interface, class, ...)
  • Java keyword (enum, package, import, extends, new, for, if, while, switch, case)
Java types and Java keyword could maybe coerced to Java keyword and Multi-line comment could be dropped in favor of using the multi-line comment setting from java color prefs. BTW: Multi-line comment colors comments with //, that's obviously wrong. And why is "enum" under Java keyword? The "Copy Java Color Prefs" button could set the colors for GJDK method (using the method setting from java) and Groovy keyword (using the keyword setting from java). GJDK method coloring should only color methods and "it" could be moved to Groovy keyword.
Hide
Permalink
Andrew Eisenberg added a comment - 30/Dec/10 6:27 PM

Working on this now...

I have added semantic highlighting for method references and the color is borrowed from JDT. I have not done anything for Type references (since this is not supported by JDT, I am not convinced that Groovy should support it, but feel free to let me know if this is something that you really want).

I have added operator and bracket syntax coloring as well. I won't be able to commit the changes today, but definitely tomorrow.

Show
Andrew Eisenberg added a comment - 30/Dec/10 6:27 PM Working on this now... I have added semantic highlighting for method references and the color is borrowed from JDT. I have not done anything for Type references (since this is not supported by JDT, I am not convinced that Groovy should support it, but feel free to let me know if this is something that you really want). I have added operator and bracket syntax coloring as well. I won't be able to commit the changes today, but definitely tomorrow.
Hide
Permalink
Benjamin Gudehus added a comment - 30/Dec/10 7:29 PM

Hi, Andrew!

I'm very excited to test this out (in the new year ).

Using the Java code example from Java > Editor > Syntax Coloring I've made a list of those element colorings which are currently supported in Groovy files.

http://pastebin.com/6VDrcEU2

Next I will build some source code with all Java and Groovy specific syntax elements, for a nice overview of currently supported syntax colorings.

Type references are not supported by the JDT? There is element coloring in Java > Editor > Syntax Coloring for Java Classes, Enums and Interfaces. Aren't they for coloring type references?

Kind regards,
Benjamin

Show
Benjamin Gudehus added a comment - 30/Dec/10 7:29 PM Hi, Andrew! I'm very excited to test this out (in the new year ). Using the Java code example from Java > Editor > Syntax Coloring I've made a list of those element colorings which are currently supported in Groovy files. http://pastebin.com/6VDrcEU2 Next I will build some source code with all Java and Groovy specific syntax elements, for a nice overview of currently supported syntax colorings. Type references are not supported by the JDT? There is element coloring in Java > Editor > Syntax Coloring for Java Classes, Enums and Interfaces. Aren't they for coloring type references? Kind regards, Benjamin
Hide
Permalink
Benjamin Gudehus added a comment - 30/Dec/10 7:33 PM

"not known" in the list at pastebin means that the element for the coloring is missing in the Java example code, so I couldn't tell if it's supported or not.

Show
Benjamin Gudehus added a comment - 30/Dec/10 7:33 PM "not known" in the list at pastebin means that the element for the coloring is missing in the Java example code, so I couldn't tell if it's supported or not.
Hide
Permalink
Andrew Eisenberg added a comment - 30/Dec/10 10:14 PM

Thanks for the pastebin snippet. You are right, interfaces, enums, and classes are colored. I'll raise a new jira for that.

There will be a change to the way single line comments are handled in this new refactoring. They will no longer be colored by Groovy-Eclipse, but rather they will be inheriting the JDT coloring. This will enable Task tags to be properly highlighted in single and multiline comments. The downside is that their color can no longer be controlled independently from JDT coloring.

Show
Andrew Eisenberg added a comment - 30/Dec/10 10:14 PM Thanks for the pastebin snippet. You are right, interfaces, enums, and classes are colored. I'll raise a new jira for that. There will be a change to the way single line comments are handled in this new refactoring. They will no longer be colored by Groovy-Eclipse, but rather they will be inheriting the JDT coloring. This will enable Task tags to be properly highlighted in single and multiline comments. The downside is that their color can no longer be controlled independently from JDT coloring.
Hide
Permalink
Andrew Eisenberg added a comment - 31/Dec/10 1:05 PM

I have committed the work I have done in this area. You can try it out from the latest nightly snapshot available here. It should be available in about an hour (if all unit tests pass):

http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.6/

This gets reasonably close to what you are suggesting (minus, of course, semantic highlighting for type references. I raised this jira to deal with this feature:

http://jira.codehaus.org/browse/GRECLIPSE-947

Show
Andrew Eisenberg added a comment - 31/Dec/10 1:05 PM I have committed the work I have done in this area. You can try it out from the latest nightly snapshot available here. It should be available in about an hour (if all unit tests pass): http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.6/ This gets reasonably close to what you are suggesting (minus, of course, semantic highlighting for type references. I raised this jira to deal with this feature: http://jira.codehaus.org/browse/GRECLIPSE-947
Hide
Permalink
Benjamin Gudehus added a comment - 17/Jan/11 10:14 AM - edited

Added Screenshots für Java and Groovy coloring in Groovy Eclipse 20101231.

There are issues with Number and Annotation coloring in context with "Copy Java Color Preferences". Number is the wrong color and the color of Annotation is to dark.

Show
Benjamin Gudehus added a comment - 17/Jan/11 10:14 AM - edited Added Screenshots für Java and Groovy coloring in Groovy Eclipse 20101231. There are issues with Number and Annotation coloring in context with "Copy Java Color Preferences". Number is the wrong color and the color of Annotation is to dark.
Hide
Permalink
Benjamin Gudehus added a comment - 07/Feb/11 6:37 PM

Great news! Two guys made an amazing eclipse plugin the manage themes.

http://www.eclipsecolorthemes.org/

Show
Benjamin Gudehus added a comment - 07/Feb/11 6:37 PM Great news! Two guys made an amazing eclipse plugin the manage themes. http://www.eclipsecolorthemes.org/
Hide
Permalink
Andrew Eisenberg added a comment - 07/Feb/11 9:22 PM

Let me know if you are able to try this out and also let me know how this interacts with Groovy-Eclipse.

Show
Andrew Eisenberg added a comment - 07/Feb/11 9:22 PM Let me know if you are able to try this out and also let me know how this interacts with Groovy-Eclipse.

People

  • Assignee:
    Andrew Eisenberg
    Reporter:
    Benjamin Gudehus
Vote (0)
Watch (0)

Dates

  • Created:
    07/Dec/10 3:52 PM
    Updated:
    29/Sep/11 4:22 PM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.