Bug 562702 - [code mining] Quick Diff highlights code mining lines instead of the source code line
Summary: [code mining] Quick Diff highlights code mining lines instead of the source c...
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.16   Edit
Hardware: All All
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Platform-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-01 13:34 EDT by Gayan Perera CLA
Modified: 2020-06-22 07:40 EDT (History)
4 users (show)

See Also:


Attachments
MethodQuickDiffError (49.92 KB, image/png)
2020-05-01 13:34 EDT, Gayan Perera CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gayan Perera CLA 2020-05-01 13:34:49 EDT
Created attachment 282658 [details]
MethodQuickDiffError

Quick Diff highlights code mining lines instead of the source code line. This happens when changing a method signature which has header code mining like unit tests code mining for example.
Comment 1 Gayan Perera CLA 2020-05-01 13:35:48 EDT
In the screenshot you can see that the quick diff highlight the header code mining line instead of the actual source code line in the method signature.
Comment 2 Gayan Perera CLA 2020-05-02 13:13:51 EDT
Seems like the CodeMiningHeaders are not taken into account when calculating the widgetLine where the Quick diff is painted. @Mickael @Angelo didn't we handled this scenario when we introduce codeminng into Eclipse?
Comment 3 Mickael Istria CLA 2020-05-04 05:14:37 EDT
(In reply to Gayan Perera from comment #2)
> Seems like the CodeMiningHeaders are not taken into account when calculating
> the widgetLine where the Quick diff is painted. @Mickael @Angelo didn't we
> handled this scenario when we introduce codeminng into Eclipse?

Many "old" pieces of code in Eclipse Text framework do assume that all lines are same standard height and have built on top of that assumptions. Code Mining has changed the habits and reveals some limitations here and there about those faulty parts of the legacy code. It was expected that there would be such glitches, and many were found before code minings were enabled by default, but some were missed and need to be fixed now.
This marker is one of them ;)
Comment 4 Gayan Perera CLA 2020-05-04 12:48:03 EDT
@Mickael
Do you have time to provide a fix? Or can you point where to look at to see a possible fix?
Comment 5 Mickael Istria CLA 2020-05-04 12:50:49 EDT
(In reply to Gayan Perera from comment #4)
> @Mickael
> Do you have time to provide a fix?

Not really, I'm dealing with a bunch of other stuff that are higher prioriy to me.

> Or can you point where to look at to see a possible fix?

I don't know, sorry.
That would require to read the code of Quickdiff to see what it actually uses and how. It's most likely somewhere in eclipse.platform.team repo, in the org.eclipse.compare bundle.
Comment 6 Gayan Perera CLA 2020-05-04 13:16:53 EDT
I think the problem is at org.eclipse.jface.text.JFaceTextUtil.computeLineHeight(StyledText, int)

I guess here the widget has more line than the model right? So is the intended way to treat these virtual lines added for codemining to be connected with the model like as well? So for example the codemining line and actual code line should be highlighted is it?
Comment 7 Mickael Istria CLA 2020-05-04 13:21:35 EDT
(In reply to Gayan Perera from comment #6)
> I guess here the widget has more line than the model right? So is the
> intended way to treat these virtual lines added for codemining to be
> connected with the model like as well? So for example the codemining line
> and actual code line should be highlighted is it?

No, the code mining are actually a single line on the widget. Code Minings manager change the line height to leave room for code minings and then print extra info, but it's still one (bigger) line, and the content is still the actual content of the line. The widget doesn't have a clue nor care about whether some code mining are drawn or not.