Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Pluggable code completion filter (was: Using doxygen comments to filter undesired code completion entries)

Hello Alain (and all)

[Alain Magloire]
> Your PR brought some flaws to the contributing scheme:
> - how to disable unwanted contributors
> - how to set policies for contributors.
> So far the only policy we have for completions (code assist) is in the
> preference page:
> Preferences --> C/C++ --> Editor --> Code Assist 

Looking through the sources I had the idea that maybe the place where
all the proposals from all the contributors are filtered is a strategic
point to implement policies. Currently this filtering is hard-coded in
the CCompletionProcessor2.computeCompletionProposals() method (below the
line with the comment // remove duplicates but leave the ones with
return types

So maybe this would be a good scheme:
- A filter class for ICCompletionProposals can be contributed to an
extension point (which is to be created).
- The preference page (Preferences --> C/C++ --> Editor --> Code Assist)
has a list of contributed filters, one of which can be selected by the
user. The preference page may display additional parameter entries,
depending on the filter which was selected, so the filter can be
customized.
- Any contributor of an ICHelpProvider can also contribute a filter
which will give "his" proposals precedence over those of other
ICHelpProviders, but the user is still free to choose the filtering
strategy according to his desires.

In my example I noticed that the HelpCompletionContributor sets the
relevance field of the ICCompletionProposals to 2 while the
DOMCompletionContributor uses relevance 1. So I could contribute a
filter which will display only those proposals with the maximum
relevance. If the user will adopt my scheme (i.e. select the filter I
contributed) then code completion will work the way I thought it should,
if he will not then he must live with duplicate entries in this case.

What do you think?


Norbert


Back to the top