Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Code completion: Handling parentheses the smart way

Hi folks, 

another issue with code completion proposals supplied from an ICHelpProvider: 
The only way to return proposal information is through an array of 
IFunctionSummary objects. Now I want to return information also for 
non-function items like global variables, types, enums etc. I can make it fit 
on the whole even though IFunctionSummary and IFunctionPrototypeSummary 
obviously assume that help should be supplied for functions only. 

But when I pick the suggestion from the completion proposal list it always 
gets parentheses () appended at the end. This is hard-coded in 
HelpCompletionContributor.contributeCompletionProposals(). A pair of 
parentheses is always appended to the (function?) name. For my purposes I 
need a smarter handling of parentheses. I see two ways to mend this:

1) Change the API description (not the code) of IFunctionPrototypeSummary so 
the the method getArguments() returns
- the empty string for an empty parameter list
- null for no parameter list, i.e. this is not information about a function at 

2) Give IFunctionSummary an additional such as an int getKind() method which 
can return information (static final int constants) about the item that is 
being described. HelpCompletionContributor can use the information to 
determine whether or not to append the parentheses pair
This of course would be an API change

What do you think? Any other suggestions? The code change is minor, agreeing 
on the way to handle this is important. Let's make the help provider fit to 
do much more than what it was designed for!



Back to the top