Bug 527943 - [javadoc] Constant values should be colored in Javadoc view/hover
Summary: [javadoc] Constant values should be colored in Javadoc view/hover
Status: REOPENED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.7   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2017-11-30 04:51 EST by Michael Gutfleisch CLA
Modified: 2017-11-30 17:49 EST (History)
4 users (show)

See Also:


Attachments
Element Info example (6.83 KB, image/png)
2017-11-30 04:51 EST, Michael Gutfleisch CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Gutfleisch CLA 2017-11-30 04:51:13 EST
Created attachment 271707 [details]
Element Info example

Example:
public static final int MAX_SPEED = 240;

F2 / Hover:
int com.example.counter.CharacterCounterExample.MAX_SPEED : 240 [0xf0]

The value 240 should be colored like literals inside source code editor.
this would reduce the time to detect the value of constants.
Comment 1 Stephan Herrmann CLA 2017-11-30 06:44:21 EST
I think what you are asking for is full syntax coloring in hovers  where currently the only adornments are linkifying and rendering of javadoc. If so, that would be a big task, potentially one where help from the community would be needed.

@Noopur, how similar are javadoc hover and source hover? In case we'd want to support this request, would it be feasible to copy functionality from the source hover, which has this highlighting?

Another problem might be the choice of colors, since hovers have their own sets of colors which may not be compatible with the syntax colors in source editors.
Comment 2 Noopur Gupta CLA 2017-11-30 09:22:57 EST
(In reply to Stephan Herrmann from comment #1)
> @Noopur, how similar are javadoc hover and source hover? In case we'd want
> to support this request, would it be feasible to copy functionality from the
> source hover, which has this highlighting?

Javadoc is presented as HTML whereas source is a string where syntax coloring is applied via source viewer configuration. So both are different.

If constant values are colored in Javadoc then it should be done for both Javadoc hover and Javadoc view, keeping the following in mind:

> Another problem might be the choice of colors, since hovers have their own
> sets of colors which may not be compatible with the syntax colors in source
> editors.
Comment 3 Lars Vogel CLA 2017-11-30 12:41:08 EST
The request from Michael is not to replicate the correct syntax highlighting in the Javadoc view/hover but to use a different highlighting to make it easier to see this. So we could use a different fixed color. I agree with Michael that is is currently hard to see the value (and the value is really important for a constant).
Comment 4 Stephan Herrmann CLA 2017-11-30 13:27:10 EST
(In reply to Lars Vogel from comment #3)
> The request from Michael is not to replicate the correct syntax highlighting
> in the Javadoc view/hover but to use a different highlighting to make it
> easier to see this. So we could use a different fixed color. I agree with
> Michael that is is currently hard to see the value (and the value is really
> important for a constant).

Michael filed this as a bug, not an enhancement request, which made it appear that  he believes syntax coloring is already in place, just one particular aspect is not working.

Since the assumption is wrong, no syntax coloring is applied, I changed it to an enhancement request, with a scope that would be consistent: full syntax coloring.

Perhaps Michael should speak for himself, if he wanted that partial (I'd say: inconsistent) solution of highlighting one aspect while leaving the rest in monochrome.

As a rule of thumb, with such partial implementation the next bunch of users will consider any missing aspect of syntax coloring as a bug, not an enhancement.

I'm pretty sure though (in correspondence with Dani setting this to wontfix) that no-one in JDT/UI has time to spare for this feature - neither partial nor complete.
Comment 5 Lars Vogel CLA 2017-11-30 16:55:14 EST
(In reply to Stephan Herrmann from comment #4)
> 
> Michael filed this as a bug, not an enhancement request

I told Michael to ignore this classification because nobody is using that. I was wrong.;-)

> Perhaps Michael should speak for himself

User new to our process are typically shy, but I discussed Michaels requirements with him in person.

> I'm pretty sure though (in correspondence with Dani setting this to wontfix)
> that no-one in JDT/UI has time to spare for this feature - neither partial
> nor complete.

Bug is already correctly marked as "helpwanted".
Comment 6 Stephan Herrmann CLA 2017-11-30 17:28:07 EST
(In reply to Lars Vogel from comment #3)
> The request from Michael is not to replicate the correct syntax highlighting
> in the Javadoc view/hover but to use a different highlighting to make it
> easier to see this. So we could use a different fixed color.

That's what I call an inconsistent or incomplete solution.
I don't see anyone in JDT/UI adopting this, even if an implementation is contributed.

> I agree with Michael that is is currently hard to see the value

I disagree, I have no problems seeing the value.

> (and the value is really important for a constant).

I disagree again. The purpose of a constant is to abstract over its value. Needing to know the value should be an exception, not the rule.

(In reply to Lars Vogel from comment #5)
> Bug is already correctly marked as "helpwanted".

I set this flag wrt the solution of full syntax coloring.
Comment 7 Lars Vogel CLA 2017-11-30 17:49:37 EST
(In reply to Stephan Herrmann from comment #6)
> (In reply to Lars Vogel from comment #3)
> I don't see anyone in JDT/UI adopting this, even if an implementation is
> contributed.

Noopur as project lead, what do you think?