Bug 6712 - [syntax highlighting] Syntax Coloring with different backgrounds & other font attributes
Summary: [syntax highlighting] Syntax Coloring with different backgrounds & other font...
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P4 enhancement with 19 votes (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 28993 51457 57180 82995 85102 88879 230247 412813 440146 (view as bug list)
Depends on: 71901
Blocks:
  Show dependency tree
 
Reported: 2001-12-08 16:30 EST by Birgit Guder CLA
Modified: 2020-11-17 04:56 EST (History)
19 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Birgit Guder CLA 2001-12-08 16:30:14 EST
The current syntax coloring scheme only allows to specify a foreground color and bold/normal 
font attribute for each syntactic element.
What is missing is the ability do define a 
different background color for some of the elements as well as further font attributes like 
italics or underline.

Ultimately, I prefer a syntax coloring scheme where 
  - all comments 
are in italics and have a slightly different background
  - Javadoc links are underlined 
  - 
...
This is currently impossible to set (in build 20011127)
Comment 1 Dirk Baeumer CLA 2002-01-10 08:20:48 EST
Would be nice to have additional attributes in syntax coloring scheme, but not 
planed for 2.0
Comment 2 Kai-Uwe Maetzel CLA 2002-09-27 14:28:44 EDT
Only background color could be added. Other styles than bold/regular are not 
supported by the StyledTextWidget. 
Comment 3 Tim Tyler CLA 2003-06-10 04:06:55 EDT
If other styles than bold/regular are not 
supported by the StyledTextWidget, then clearly
the StyledTextWidget needs either updating or
abandoning.
Comment 4 Brian Krispinsky CLA 2003-06-26 22:27:53 EDT
Another good addition to this would be to allow coloring of additional tokens. 
Instead of having a generic "Other" token, allow coloring by "Identifier",
"Operator", "Numeric", etc.
Comment 5 Dani Megert CLA 2004-02-11 07:11:39 EST
*** Bug 51457 has been marked as a duplicate of this bug. ***
Comment 6 Dani Megert CLA 2004-04-02 02:22:44 EST
*** Bug 57180 has been marked as a duplicate of this bug. ***
Comment 7 Dani Megert CLA 2004-07-07 08:59:14 EDT
Bold and italic are available since 3.0.

Adding background color conflicts with annotations where you can set the
background but not the foreground color. If we add support for bg color in
syntax coloring then we also have to add fg color option to annotations.
Comment 8 Dani Megert CLA 2005-01-17 14:28:07 EST
*** Bug 82995 has been marked as a duplicate of this bug. ***
Comment 9 Dani Megert CLA 2005-02-14 07:02:29 EST
*** Bug 85102 has been marked as a duplicate of this bug. ***
Comment 10 Dani Megert CLA 2005-03-23 12:33:02 EST
*** Bug 88879 has been marked as a duplicate of this bug. ***
Comment 11 Dani Megert CLA 2005-04-07 13:22:52 EDT
Underline and strikethrough are now also available
Comment 12 Luke Maurer CLA 2005-07-04 07:55:23 EDT
(In reply to comment #7)
> Bold and italic are available since 3.0.
> 
> Adding background color conflicts with annotations where you can set the
> background but not the foreground color. If we add support for bg color in
> syntax coloring then we also have to add fg color option to annotations.

Why not have the annotation background override the syntax background, like
everything else?
Comment 13 Luke Maurer CLA 2005-07-04 07:56:07 EDT
(er, I mean every other IDE out there)
Comment 14 Mladen Mihajlovic CLA 2005-12-14 12:05:05 EST
The WTP project does do this. I think it would have HUGE benefit! 

Please, please, pretty please ;)
Comment 15 Prashant Deva CLA 2007-11-09 03:49:52 EST
Just curious whether anyone is working on this bug. Can  we have this for 3.4?

It would be great to be able to assign different background color to various tokens. This is especially useful in highlighting strings in code.
Comment 16 Dani Megert CLA 2007-11-09 04:11:34 EST
>Can  we have this for 3.4?
Different font attributes might come in the future (not for 3.4) but we will never support to set the background.
Comment 17 Prashant Deva CLA 2007-11-09 04:14:13 EST
Out of sheer curiosity, but why would you 'never' want to support background color? Is it too much engineering or something else?
Comment 18 Dani Megert CLA 2007-11-09 04:16:35 EST
Because highlighting/background is reserved for annotations (e.g. search results, occurrence marks etc.).
Comment 19 Dani Megert CLA 2008-05-06 02:21:50 EDT
*** Bug 230247 has been marked as a duplicate of this bug. ***
Comment 20 Tad Marko CLA 2008-05-06 09:01:52 EDT
From comment #7

> Adding background color conflicts with annotations where you can set the
> background but not the foreground color. If we add support for bg color in
> syntax coloring then we also have to add fg color option to annotations.

I don't really see how that is any special engineering problem. I'm not even sure how annotations affect this, as they'll have whatever background they have and the other elements will have whatever they have. It seems like most of the work is already done and there are not real conflicts.

There definitely seems to be enough interest in this feature that it should be implemented. Why is there such resistance to implementing this 1990's IDE feature?
Comment 21 Dani Megert CLA 2008-06-18 05:57:27 EDT
*** Bug 28993 has been marked as a duplicate of this bug. ***
Comment 22 Nigel Magnay CLA 2008-09-20 13:35:03 EDT
> Because highlighting/background is reserved for annotations (e.g. search
> results, occurrence marks etc.).

But that doesn't make any sense. Why can't annotations (e.g. errors) simply take precedence?

It's really annoying and inconsistent. I can set background colors for items in the XML editor and this is really useful (e.g. shows easily which areas are comments and CDATA and which are just tags). But in the Java editor I can't.
Comment 23 Nitin Dahyabhai CLA 2008-09-30 00:53:59 EDT
(In reply to comment #22)
> But that doesn't make any sense. Why can't annotations (e.g. errors) simply
> take precedence?
> 
> It's really annoying and inconsistent. I can set background colors for items in
> the XML editor and this is really useful (e.g. shows easily which areas are
> comments and CDATA and which are just tags). But in the Java editor I can't.

Woah, don't go dragging us into this :), I pulled background colors out of the XML Editor for a milestone during 2.0.  I agree with what Dani said in comment 18: having background colors in both places muddles things by having it represent both text annotations and the syntax, making it represent two unrelated concepts.  That said, there were complaints so we put it back into the following milestone.  You'll notice, though, that none of the provided syntax coloring defaults in WTP include a background color.
Comment 24 Nigel Magnay CLA 2008-09-30 05:26:10 EDT
> I agree with what Dani said in comment
> 18: having background colors in both places muddles things by having it
> represent both text annotations and the syntax, making it represent two
> unrelated concepts.  That said, there were complaints so we put it back into
> the following milestone.  You'll notice, though, that none of the provided
> syntax coloring defaults in WTP include a background color.
> 

Ok - but what you're saying here is a value judgement, and that is that "*I* think it's confusing".

1) Not everybody agrees with this - the fact that this bug exists, the fact that people complained when a similar feature was taken out of the XML editor, and you can find several web pages mentioning the fact (I suspect most people, like me, assumed it was a feature that was yet to be done, rather than one that was being avoided).

2) Other IDEs don't agree with this. For example, IntelliJ supports setting background colors - in fact, it's default Out-of-the-box configuration sets background colors for several things. 

Not making the defaults change background colors seems a matter of taste; not making the background colors changeable at all seems obstinate.
Comment 25 Amenel Voglozin CLA 2010-01-13 04:39:13 EST
(In reply to comment #24)
I have to agree with Nigel here. I don't see how anyone can ever defeat his arguments.

8 years and running... Several bugs reports marked as duplicate of this... The largest number of votes. What else is needed for this to be considered something worth implementing ?

Users are not stupid. We know that background color for syntax coloring will "conflict" (I prefer "be ambiguous") with background color for annotations. If somone decides to set the same color for both, isn't it THEIR problem ? Why would a feature that's been requested so many times not be offered because "it may confuse someone". 

Better have the option and not use it than rage against not having it.
Comment 26 Johan Walles CLA 2010-01-13 05:21:32 EST
(In reply to comment #25)
> The largest number of votes.

It's actually number 13 among the JDT bugs currently:
https://bugs.eclipse.org/bugs/buglist.cgi?bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&classification=Eclipse&product=JDT&query_format=advanced&votes=10&order=votes

Would be nice to have though.
Comment 27 Amenel Voglozin CLA 2010-01-13 06:40:46 EST
(In reply to comment #26)
> (In reply to comment #25)
> > The largest number of votes.
> 
> It's actually number 13 among the JDT bugs currently:
> https://bugs.eclipse.org/bugs/buglist.cgi?bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&classification=Eclipse&product=JDT&query_format=advanced&votes=10&order=votes
> 
> Would be nice to have though.

Yes, mea culpa, it was number 1 in my search results (and not in all the bugzilla repository).
Comment 28 Jakob Ilves CLA 2010-11-12 14:35:20 EST
Having custom background color for certain syntax elements is really useful, I've grown used to it using jEdit, so I would appreciate if it could be included in Eclipse.

I know it poses certain challenges (and that there is no such thing as a "trivial addition" to a program) but have a sneak peek at how jEdit implements it, both from a behavior perspective (e.g how to handle when a custom background color is used for highlighting the current line but at the same time, that specific line contains syntax elements with a different custom color) as well as from a code perspective (jEdit, just as Eclipse, is an open source Java program).
Comment 29 Dani Megert CLA 2013-07-15 04:56:40 EDT
*** Bug 412813 has been marked as a duplicate of this bug. ***
Comment 30 Art Bergquist CLA 2013-07-17 17:20:25 EDT
I had background syntax coloring for years in Visual FoxPro.  My preference was to highlight strings with a background color of yellow to make it look like I had used a highlighter to highlight all the text in a string.
Comment 31 Mladen Mihajlovic CLA 2014-06-17 07:25:48 EDT
Wow, I was comment number #14 all the way in 2005 and this is still no closer to being done.
Comment 32 Dani Megert CLA 2014-07-23 07:34:00 EDT
*** Bug 440146 has been marked as a duplicate of this bug. ***
Comment 33 Prashant Deva CLA 2014-07-23 12:38:34 EDT
10 years of this bug...