Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 343055 - [content assist] Code completion filtering on first activation
Summary: [content assist] Code completion filtering on first activation
Status: RESOLVED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.6.2   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: api
Depends on:
Blocks:
 
Reported: 2011-04-16 21:22 EDT by Fabio Zadrozny CLA
Modified: 2011-04-18 06:12 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fabio Zadrozny CLA 2011-04-16 21:22:40 EDT
Build Identifier: I20100608-0911

I have the following use case in PyDev:

In Python, by convention, methods/attributes starting with '_' should be considered private, so, when a code-completion is requested, they should not be brought, but if the user types the '_' only those should be brought.

E.g.:

Let's say accessing a token 'a' brings completions '_method1' and 'method2', what I want is providing the '_method1' and 'method2' completions but filtering out '_method1' unless '_' is typed (in which case it should filter the other completions).

So, my request is adding that support as an option for the ContentAssist (note that it's not possible to make that work right now as all the PyDev completions must implement ICompletionProposalExtension2 -- if that wasn't the case, the problem wouldn't appear as the completions would be always recomputed at each step).

I was thinking something like:

At org.eclipse.jface.text.contentassist.CompletionProposalPopup.showProposals(boolean), after setting the proposals and before displaying them, check if fContentAssistant implements a new interface IContentAssistantExtension5 with a method 'getFilterOnInitialRequest()', if it does and returns true, call the fFilterRunnable.run().

If this is accepted, I can create a proper patch for it (and would like to get this solved ASAP -- hopefully for 3.7).

Thanks,

Fabio

Reproducible: Always
Comment 1 Dani Megert CLA 2011-04-18 06:12:59 EDT
We want that the user gets a consistent behavior when using content assist in different products which is
- filtering when typing
- get more results when going to the left again with cursor
- filtering again by going to the right again with cursor
- move less relevant proposals (_* in your case) to the end

Hence we don't want to add API that encourages a different workflow.

Having said that, if you don't like that workflow, I think you could simply filter the _* proposals when content assist is invoked the first time. When the user then presses '_' it aborts the completion automatically (that's out of the box behavior). You could register a key and a ICompletionListener listener to detect that case and restart content assist.