Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 147781

Summary: [content assist] Ctrl+Shift+Space does not use proposal kinds settings
Product: [Eclipse Project] JDT Reporter: Mik Kersten <mik.kersten>
Component: TextAssignee: JDT-Text-Inbox <jdt-text-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P4 CC: daniel_megert, mlists
Version: 3.2Keywords: helpwanted
Target Milestone: 3.4 M1   
Hardware: PC   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 129080    
Attachments:
Description Flags
Fix none

Description Mik Kersten CLA 2006-06-19 16:16:55 EDT
The Ctrl+Shift+Space context information seems to use all the proposal computer available rather than the currently selected list of proposal kinds.  In the case of Mylar this means that users see two duplicated lists of entries, since the Mylar proposal kinds extend and enhance the JDT kinds.
Comment 1 Dani Megert CLA 2006-06-20 03:11:54 EDT
Tom, please investigate.
Comment 2 Tom Hofmann CLA 2006-06-21 04:14:14 EDT
ContentAssistant currently does not issue content assist session events when context information is requested (doesn't make sense, as there is no such thing as incremental context information or as-you-type filtering).

org.eclipse.jdt.internal.ui.text.java.ContentAssistProcessor only does the "enabled/disabled/cycling" category dance when it receives content assist events.

I believe the right thing to do is to collect context information for any categories that are either in the default group or enabled as separate category, but not the ones that are disabled.
Comment 3 Mik Kersten CLA 2006-06-21 11:03:38 EDT
That sounds right, and just to be clear what I see happening now is the disabled ones showing up as well.  
Comment 4 Mik Kersten CLA 2007-02-01 15:04:34 EST
So I assume this won't make it for 3.3?  I can make a FAQ entry.  I've only heard one Mylar user complain about this so assume Ctrl+Shift+Space is not that popular, but if more people add proposal computers it could lead to more unexpected behavior of this sort.
Comment 5 Dani Megert CLA 2007-02-02 04:50:03 EST
Yes, we won't have time for this.
Comment 6 Mik Kersten CLA 2007-07-09 23:35:09 EDT
Daniel: could you consider this for 3.4?  Without it Mylyn does not have a way of addressing the duplicate entries (bug 129080).  Let me know if we should try to gather additional votes on the priority of this, since beyond the comments on bug 129080 I have no idea how commonly used Ctrl+Shift+Space is.
Comment 7 Dani Megert CLA 2007-07-10 02:24:28 EDT
Sorry but I'm not sure whether we will have time for this. A patch would gladly be accepted.
Comment 8 Eugene Kuleshov CLA 2007-07-12 15:26:38 EDT
Daniel, can you please give some hints where to look at this and what is the related code that could be used?
Comment 9 Dani Megert CLA 2007-07-16 08:21:59 EDT
Hi Eugene,

this should be pretty simple to achieve: the code in org.eclipse.jdt.internal.ui.text.java.ContentAssistProcessor.computeContextInformation(ITextViewer, int) needs to be adjusted. The simplest patch simply ignores those from the disabled processors. You can use org.eclipse.jdt.internal.ui.text.java.ContentAssistProcessor.computeCompletionProposals(ITextViewer, int) as a template.

NOTE: computeContextInformation(...) should also contain all the saftey code that's in computeCompletionProposals but we obviously forgot that. To make your patch perfect you could add that code as well ;-)
Comment 10 Eugene Kuleshov CLA 2007-07-16 10:01:36 EDT
Thanks Daniel, I can take a look at computeContextInformation(), but I am not really familiar with the required safety code. Can you please elaborate on that or point me to some examples?
Comment 11 Dani Megert CLA 2007-07-16 10:24:19 EDT
It's the code that's already in computeCompletionProposals i.e.
- warn if a processor takes too long
- warn if a processor fails
Comment 12 Eugene Kuleshov CLA 2007-07-16 11:01:58 EDT
Are you referring to the stuff that can be enabled with DEBUG? If not, I guess it isn't really obvious to me... both proposal and context collectors set fErrorMessage field similarly down to CompletionProposalComputerDescriptor.
Comment 13 Dani Megert CLA 2007-07-17 04:02:44 EDT
Sorry Eugene, it was too hot here yesterday - sigh!

The stuff I mentioned is just the entry point and too far away from where the fix would have to be put in place. There's a general problem here though: while we have full support for code assist (Ctrl+Space) configuration we don't have anything similar for Ctrl+Shift+Space, e.g. you can't toggle through the categories by hitting another Ctrl+Shift+Space like it can be done with Ctrl+Space.

Since I led you into the wrong direction I thought it's fair to fix this myself. For now I disable the categories that are neither checked in the default nor the cycling list.

Please try out the attached patch whether it works for you guys.

Fixed in HEAD.
Available in builds >= I20070717-0800.
Comment 14 Eugene Kuleshov CLA 2007-07-17 09:46:15 EDT
Wau! Thanks Daniel. I'll try the integration build.
PS: by the way, did you actually meant to attach patch to the bug report?
Comment 15 Dani Megert CLA 2007-07-17 09:48:49 EDT
Created attachment 73945 [details]
Fix