Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Enumeration facility

> I have my own editor DOTEditor that extends CEditor. It has its own
> SourceViewerConfiguration and CompletionProcessor but both extend CDT
> counterparts. This is only to add some more custom facilities to the
> existing CDT.

> One of the custom thing is to add code assist facility for enumeration
> parameters. When a method/function is being written and if the parameter
> being typed is of type enumeration and uses says CTRL+SPACE, then I have fix
> to fetch the list of values for a database.
> This is what I have done in the custom completion processor
> public class TMECompletionProcessor  extends CCompletionProcessor
> {
>  public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer,
> int documentOffset) 
>      {
>         //Get the proposals from CDT
> 	ICCompletionProposal[] results = null;
> results=(ICCompletionProposal[])super.computeCompletionProposals(viewer,
> documentOffset);           
>         //Now add my list of proposals
>         //I am getting completion node through which I can get the details
>         IASTCompletionNode completionNode = getCurrentCompletionNode();
>         //I get completionNode.Kind and it gives
> CompletionKind.FUNCTION_REFERENCE when filling parameters in function calls
>         if(kind == CompletionKind.FUNCTION_REFERENCE)
>         {
>           //Here in which I want to identify which parameter the user is at
>           //How to get this. CDT people pls. help
>         } 
>      }
> }

If I get this right, you want the position of the parameter ?
So for something like this:

int foobar(int a, int b, int c);

int main(..) {
   int a, b, c;
  foobar(a, //CTL_SPACE

you want to know if we are at the second argument ?

Back to the top