Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] C++ Hover Help

Hi Jeff,

the AST of the acctive editor is usually cached (see ASTProvider)
exactly for this purpose.
This AST must be accessed using an ASTRunnable. You will find several
usage examples in the code, including hovers.

This is is all internal stuff, though, but I guess it would make sense
to provide some public API to access the shared AST.
Would you mind filing a bug on that? 

Do you intend to contribute the extension to the


> -----Original Message-----
> From: cdt-dev-bounces@xxxxxxxxxxx 
> [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Jeff Johnston
> Sent: Thursday, December 04, 2008 10:08 PM
> To: cdt-dev@xxxxxxxxxxx
> Subject: [cdt-dev] C++ Hover Help
> Has anybody successfully implemented C++ hover help/completion for 
> member functions?
> I have been looking into it to support the libstdc++ library 
> documentation and have reached an impasse.
> I am attempting to extend an existing ICHelpProvider 
> extension.  I don't 
> think the ICHelpProvider extension was ever meant to support 
> C++ since 
> it only passes the member name and does not give enough 
> information to 
> figure out the context (i.e. what class it is really from and 
> what it's 
> parameter signature is). 
> To get around this problem, I created an interface that extends 
> ICHelpInvocationContext and provides the IRegion of the call being 
> hovered over.
> For example,
>     std::string *k = new string("abc");
>     k->size();
> Hovering over size, we can figure out from the 
> TranslationUnit contents 
> that size is being referenced by a pointer k and has no parameters.
> Now to figure out what k points to.  This information can be found in 
> the AST from the TranslationUnit that is already passed in the 
> ICHelpInvocationContext (via the getAST methods).
> A major snag I have run into is that it is taking far too long to get 
> the AST.  I timed over 10 seconds debugging my simple C++ Hello world 
> example which added the above 2 statements.  This is too long 
> to expect 
> a user to wait to get hover help.  I tried using the 
> resulted in a 
> null IASTTranslationUnit.  Theoretically, could it not figure 
> out that k 
> points to an unknown type: std::string without looking at any 
> headers?  
> Obviously, this would not support macro expansion, but it 
> would cover a 
> lot of scenarios.  Just a thought.
> Is there anything I could have done differently which would 
> speed things 
> up enough to be useful?
> Am I trying to solve a problem already figured out by somebody else?
> Thanks,
> -- Jeff J.
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx

Back to the top