Vim Intellisense - C++ Plug-in

User's Guide

 

Introduction

The Vim Intellisense - C++ plug-in brings in Intellisense details to the C++ developer in VIM. The following keys pops up the Intellisense window,

 

Key

 Lists…

.

 List the methods and variables of the class on whose object . is pressed

->

List the methods and variables of the class on whose object -> is pressed

::

For class:

List the static members of the class.

For namespace:  List types and functions defined under the namespace

For global namespace:

List functions and types of global namespace. Note: only first 200 entries are listed. See TODO

(

List the tool tips for the function or method on which ( is typed.

#include <

List all the header files from the all folders set in the system variable INCLUDE

 

 

The cppft.dll is invoked from insen.exe to list the context specific contents. The input parameter is specified in the %TEMP%/VimHelperParam.txt

The cppft.dll uses perl and ctags to generate the listings for the object on which insen was invoked.

 

Prerequisite
v      ActivePerl 5.8 and above should have been installed on the system and perl.exe should be in path. Active Perl can be freely downloaded from www.activestate.com.
v      INCLUDE system variable should be set with the correct paths.
v      TEMP folder should be defined with a temporary folder name.
Screen Shots
How does it work?
  1. The plug-in collects all the included files (recursively) and generates a tag file using ctags.exe (shipped along with insen). This is generated one time per session and per file. The tag file is generated in %TEMP% folder as InsenVimAllTags.tag. This file is cached for further usage. Also see caching.
  2. The include files list is collected starting from #included files of the current file and then in the files that are read using the #include. This continues until there are no new #include files found while doing this recursive parsing.
  3. For . and -> it parses the current file and then the included files to find the class of the object and lists the members of that class.
  4. For :: the symbol before :: is taken as type and the static members of the type is listed.
  5. For ( the tool tip of the method or function is listed.

 

Caching

The InsenVimAllTags.tag is generated each time a session is changed. For e.g. if you open a VIM and started A.cpp. Now first time insen is required the tags file is generated for the include files starting root from the #included files of A.cpp. 

 

From then on as long as you are in A.cpp the same tag file is used to list the members.

 

Now if you open another c++ file B.cpp (in the same Vim window or another window) and invoked insen the cache is cleared and the InsenVimAllTags.tag file is generated for the new set of include files.

 

You have to remove the cache manually in the following cases,

 

  1. A new header file is #included in the current file
  2. A new function/type is added to one of #included file
  3. a new type is added to the current file

 

To remove the caching manually you have to invoke vim method IN_VisReload(). i.e.  Type :call IN_VimReload() from the command of VIM. Alternatively you can delete the InsenVimAllTags.tag in the %TEMP% folder.

 

 

Include files listing cache….

The header files present in all the folders of the INCLUDE path. This is generated for the first time you invoke this listing and cached in the file VimHelper.txt_CACHE  in the %TEMP% folder. So if are adding a new path to INCLUDE you have to delete this file so that the header files in the new path is added to the list.

 

Trouble Shooting
When the insen is not listed you can use information in this section to trouble shoot yourself.
1.      Check %TEMP% folder for VimHelperParam.txt is generated. Check if the contents make sense to what you have typed in C++ file.
2.      Check if the VimHelper.txt is generated and if the listing in that file is proper.
3.      If this file is not generated check the below things,
a.      You have #included the header file which contains the definition of the class for which you are expecting the Intellisense.
b.      You have added the path of the include file to the INCLUDE path.
c.      Perl.exe is in path and it is the ActivePerl5.8 version.
d.      Remove the cache and try again.
4.      Also check insen_cppft.log is generated in the %TEMP% folder. Check if there are any error reports in this file.
5.      To generate the trace messages set a system variable INSENVIM_CPPFT_INFO_LOG to 1 and try again. Now the insen_cppft.log file will hold the trace message. Read it and see if can fix the problem.
 
6.      Mail me  madhan.ganesh AT siemens DOT com or sravishankar AT gmail DOT com the problem along with the log file. We will help you run insen with our best efforts.
 TODO
v      Typedefs have to be understood by insen plug-in.
v      COM components have to taken care.
v      CTRL-SPACE should complete the insen.
v      :: should list all the elements of global namespace.
v      Insen should be made to work even in the middle of the line
v      Templates should be differentiated from classes.
v      Help of the types and methods should be brought.
 
Happy Vimming….
Madhan
 
 
 
 
 

Return Home