| Summary: | [hover] Improper hover order prevents using the right hover | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Marc Khouzam <marc.khouzam> | ||||||||||
| Component: | cdt-editor | Assignee: | Marc Khouzam <marc.khouzam> | ||||||||||
| Status: | RESOLVED FIXED | QA Contact: | Anton Leherbauer <aleherb+eclipse> | ||||||||||
| Severity: | normal | ||||||||||||
| Priority: | P3 | Flags: | aleherb+eclipse:
review+
|
||||||||||
| Version: | 6.0 | ||||||||||||
| Target Milestone: | --- | ||||||||||||
| Hardware: | PC | ||||||||||||
| OS: | Linux | ||||||||||||
| Whiteboard: | |||||||||||||
| Attachments: |
|
||||||||||||
|
Description
Marc Khouzam
Created attachment 151880 [details]
Proposed fix
This proposed patch preserves the order of the hovers in BestMatchHover. I preserved the API (although the class in internal), and I tried to minimize the performance impact (although the lists and arrays are of 6 elements for bare CDT).
I will wait until tomorrow to commit, to wait for any comments.
Toni can you review when you have time?
Created attachment 151904 [details]
Small tweak to previous fix
I had the size of the array in the patch one element too big.
Good catch! I would like to address this a little different for 2 reasons: - I don't like the fNullEntryCount - The semantics of addTextHover() should be preserved Patch follows. Created attachment 151932 [details]
Alternative fix
(In reply to comment #4) > Created an attachment (id=151932) [details] > Alternative fix I agree that this is easier to understand. But there are two reasons why I didn't choose a similar solution: 1- fTextHoverSpecification is no longer shrunk as elements are removed from it. This impacts performance. I realize we only have 7 elements, so it is not a big deal, however, since the elements are contributed by extension point, we could have many more. But I didn't know if it was worth being careful about this so I played it safe, but I'm ok with your solution for this case. 2- More important, the addTextHover() overridable method is no longer called. I figured that we should keep using this method to be consistent with the API. And this is where things got ugly and I had to use the fNullEntryCount, to avoid changing the signature of addTextHover(). Now, this class is internal, so we could change it, but I didn't want to make that decision :-) If you are ok with both points above, then I'm ok with it too. I would remove the addTextHover() method in this case. Just let me know and I can commit it if you'd like. FYI, I've opened Bug 294833 on JDT for this similar issue. The two bugs are independent because they use different copies of the code. (In reply to comment #5) > I agree that this is easier to understand. But there are two reasons why I > didn't choose a similar solution: > > 1- fTextHoverSpecification is no longer shrunk as elements are removed from it. The performance impact should be neglectable. > 2- More important, the addTextHover() overridable method is no longer called. > I figured that we should keep using this method to be consistent with the API. > And this is where things got ugly and I had to use the fNullEntryCount, to > avoid changing the signature of addTextHover(). Now, this class is internal, > so we could change it, but I didn't want to make that decision :-) From my POV, addTextHover() is protected to allow subclasses to add additional hovers. But as it is an internal class and there is no subclass within CDT this is actually a non-issue anyway :). > If you are ok with both points above, then I'm ok with it too. I would remove > the addTextHover() method in this case. Just let me know and I can commit it > if you'd like. Yes, that's OK. (In reply to comment #6) > FYI, I've opened Bug 294833 on JDT for this similar issue. The two bugs are > independent because they use different copies of the code. I am curious how the final fix will look like in JDT. (In reply to comment #7) > > If you are ok with both points above, then I'm ok with it too. I would remove > > the addTextHover() method in this case. Just let me know and I can commit it > > if you'd like. > > Yes, that's OK. > > (In reply to comment #6) > > FYI, I've opened Bug 294833 on JDT for this similar issue. The two bugs are > > independent because they use different copies of the code. > > I am curious how the final fix will look like in JDT. I will commit the CDT fix now as the JDT one may take some time to be reviewed. If they come up with a nicer solution, we can change ours. Created attachment 151941 [details]
Small tweak to alternative fix
This is the patch I committed.
As I was about to commit Toni's patch, it bothered me that we were using list with default size of 2 when we know that we have more hovers. In fact, we know how many the list will contain, so I made that change.
Fixed JDT's solution is very similar. |