Product SiteDocumentation Site

2.2.2. libhover Plug-in

The libhover plug-in for Eclipse provides plug-and-play hover help support for the GNU C Library and GNU C++ Standard Library. This allows developers to refer to existing documentation on glibc and libstdc++ libraries within the Eclipse IDE in a more seamless and convenient manner via hover help and code completion.
For C++ library resources, libhover needs to index the file using the CDT indexer. Indexing parses the given file in context of a build; the build context determines where header files come from and how types, macros, and similar items are resolved. To be able to index a C++ source file, libhover usually requires you to perform an actual build first, although in some cases it may already know where the header files are located.
The libhover plug-in may need indexing for C++ sources because a C++ member function name is not enough information to look up its documentation. For C++, the class name and parameter signature of the function is also required to determine exactly which member is being referenced. This is because C++ allows different classes to have members of the same name, and even within a class, members may have the same name but with different method signatures.
In addition, C++ also has type definitions and templated classes to deal with. Such information requires parsing an entire file and its associated include files; libhover can only do this via indexing.
C functions, on the other hand, can be referenced in their documentation by name alone. As such, libhover does not need to index C source files in order to provide hover help or code completion. Simply choose an appropriate C header file to be included for a selection.

2.2.2.1.  Setup and Usage

Hover help for all installed libhover libraries is enabled by default, and it can be disabled per project. To disable or enable hover help for a particular project, right-click the project name and click Properties. On the menu that appears, navigate to C/C++ General > Documentation. Check or uncheck a library in the Help books section to enable or disable hover help for that particular library.
Enabling/Disabling Hover Help
Figure 2.18. Enabling/Disabling Hover Help

Disabling hover help from a particular library may be preferable, particularly if multiple libhover libraries overlap in functionality. For example, the newlib library (whose libhover library plug-in is supported in Red Hat Enterprise Linux 6) contains functions whose names overlap with those in the GNU C library (provided by default); having libhover plugins for both newlib and glibc installed would mean having to disable one.
When multiple libhover libraries libraries are enabled and there exists a functional overlap between libraries, the Help content for the function from the first listed library in the Help books section will appear in hover help (i.e. in Figure 2.18, “Enabling/Disabling Hover Help”, glibc). For code completion, libhover will offer all possible alternatives from all enabled libhover libraries.
To use hover help, simply hover the mouse over a function name or member function name in the C/C++ Editor. After a few seconds, libhover will display library documentation on the selected C function or C++ member function.
Using Hover Help
Figure 2.19. Using Hover Help

To use code completion, select a string in the code and press Ctrl+Space. This will display all possible functions given the selected string; click on a possible function to view its description.
Using Code Completion
Figure 2.20. Using Code Completion