c/c++ editor Hover for functions [message #228226] |
Sat, 20 December 2008 20:08  |
Eclipse User |
|
|
|
Hello there,
I don't understand how the Hover-functionality is working.
I did not find anything in the manual / google / forum...
As testing several constilations, I came to the conclusion,
that there are 3 types of Hover:
TYP1 Hover for Macro Expansion
TYP2 Hover for functions - information from the header-file shows up
(if there is a comment above, it also shows up)
TYP3 Hover for functions - actual code of the implementation shows up
e.g.:
I have a *.h file like:
-------------------------------
/*
* documentation of my function
* this function adds a and b
*/
int myfunc(int a, int b);
-------------------------------
and a *.c file like:
------------------------------
int myfunc(int a, int b){
return a+b;
}
------------------------------
Now I use the function in my main.c and I want to use the Hover for heades
(TYP2)
But it seems to be very random wich code the editor uses for the hover.
Maybe this has something to do with indexing...?
P.S.: Window>Preferences>C/C++>Editor>Hovers>Combined Hover is checked
I would be glad to have your explanation.
|
|
|
Re: c/c++ editor Hover for functions [message #228482 is a reply to message #228226] |
Thu, 08 January 2009 07:54   |
Eclipse User |
|
|
|
alex a wrote:
> Hello there,
> I don't understand how the Hover-functionality is working.
> I did not find anything in the manual / google / forum...
>
> As testing several constilations, I came to the conclusion,
> that there are 3 types of Hover:
>
> TYP1 Hover for Macro Expansion
> TYP2 Hover for functions - information from the header-file shows up
> (if there is a comment above, it also shows up)
> TYP3 Hover for functions - actual code of the implementation shows up
>
> e.g.:
> I have a *.h file like:
> -------------------------------
> /*
> * documentation of my function
> * this function adds a and b
> */
> int myfunc(int a, int b);
> -------------------------------
>
>
> and a *.c file like:
> ------------------------------
> int myfunc(int a, int b){
> return a+b;
> }
> ------------------------------
>
>
> Now I use the function in my main.c and I want to use the Hover for
> heades (TYP2)
> But it seems to be very random wich code the editor uses for the hover.
> Maybe this has something to do with indexing...?
>
>
> P.S.: Window>Preferences>C/C++>Editor>Hovers>Combined Hover is checked
>
> I would be glad to have your explanation.
>
>
The types of hovers available are listed in the Hover preference page.
The 'Combined Hover' tries all other hover types (enabled or not) in
order and the first hover producing output will be shown.
The hover type you are referring to is the 'Source Hover'. As the name
implies, the hover is meant to show source code of an element (function,
variable, etc.).
It prefers the definition of a function if it can be found (depends on
index). If it cannot be found it takes a declaration.
Any preceding comment is included.
What you probably expect is a hover which extracts documentation from a
comment similar to the Javadoc hover of JDT. We don't have that yet.
The 'Documentation Hover' type listed in the preference page only
displays help content which has been contributed to the
org.eclipse.cdt.ui.CHelpProvider extension point.
HTH
--
Anton Leherbauer
Wind River Systems, Austria
CDT Committer - http://www.eclipse.org/cdt
DSDP/DD Committer - http://www.eclipse.org/dsdp/dd
|
|
|
|
Re: c/c++ editor Hover for functions [message #228862 is a reply to message #228796] |
Sat, 17 January 2009 05:07  |
Eclipse User |
|
|
|
alex a schrieb:
> Thanks for the reply.
>
> In deed, something like Javadoc would be verry helpfull. But it will do
> the work, if I get the comment from the header file, when "hovering".
>
> You said, that it has something to do with indexing. So what should i I
> do, that the Indexer find the *.h-files.
>
> As mentioned above, my hover is verry random jet. Sometimes the
> defenition shows up, sometimes the declaration of the element.
>
> Please help!
>
> Greetings from LMU Munich
>
It's hard to tell what your specific problem is, but the usual suspect
is an incomplete include search path. You can search for unresolved
includes: Right Click on Project > Index > Search for Unresolved Includes
Try to minimize the number of unresolved includes by adding include
directories on the Paths and Symbols properties page of your project.
Don't forget to rebuild the index afterwards (Right Click on Project >
Index > Rebuild).
If you have the Error Log view installed (it is not part of the plain
C/C++ package), it will show an info entry with some statistics about
indexing.
HTH
Greetings from Salzburg!
--
Anton Leherbauer
Wind River CDT Team, Austria
|
|
|
Powered by
FUDForum. Page generated in 0.03286 seconds