Vim Intellisense -Java Plugin

by Madan Ganesh



Java plug-in for Vim Intellisense provides intellisense for a java file. The insen executable invokes the javaft.dll to get method-list, tool-tip, documentation etc., The javaft.dll in-turn delegate the calls to javaft.jar component via JNI mechanism. The javaft.jar is the work-horse for java intellisense plug-in. This document explains the design of java insen package and describe its components. This is depicted in figure below.









The insen executable writes the insen parameters in the VimHelperParam.txt file in the %TEMP% folder and invokes the plug-in based on the file type being typed. For a .java file the executable invokes the javaft.dll which implements the interface published for plug-in.  The implementation requires to implement below mentioned functions,


Published Methods   Invoked when... Implementation Requirement for a java file
GetMethodList When a . is typed

If 'dot' is typed after a variable, list the members of the type corresponding to that variable. If 'dot' is typed after a TypeName list the static members of that type. If 'dot' is typed after a package name list the TypeNames under that package.

GetTooltip When a ( is typed

List the overloaded signatures of the method for which the tool-tip is invoked.

GetDoc When the documentation has to be displayed for member listed thru GetMethodList

Give the documentation corresponding to the member (listed via the GetMethodList method)

GetGenList When a Ctrl-Space is typed

List all the imported TypeNames and all members in the current scope.



The insen package splits the line where insen is invoked to know the token typed before the '.' or '(' .  The token is identified for a variable name or TypeName or Package name. Based on the identification a Lister is instantiated. The lister can be a MemberLister or PackageLister. The MemberLister is initialized with a Type whose members have to be listed. The lister finds the TypeInfo from which the members information is obtained.





This class is called from the javaft.dll. The static methods are invoked for listing member variables, tool-tip and ctrl space.

This class acts like a main method for the java insen package. It reads the param file, instantiates the appropriate lister and invokes the list method on it.

The lister object last invoked is stored as member static variable sm_lister, and the same is used when the insen is called back to  retrieve the documentation


This class is designed to abstract the parsing of the source file from  which the insen is  invoked. This class parses the java source file to know about the  packages imported, TypeName of a declared variable etc., 


 This class acts as a factory to create a lister based on the expression typed  before the 'dot'. Two types of listers are identified in insen,

                a) MemberLister

                                lists the members of a specific type. It has 2 variants; one

                                lists only static method and the other lists both static and

                                non-static members.


                b) PackageLister

                                lists the sub packages and the TypeNames of a parent package.


  On a high level, this class creates one of the lister (based on what for

  the insen is invoked) and gives it back to the caller.



This class encapsulates the functionality of enlisting the class members.

The MemberLister takes the types whose members is to be listed when the  list is called.


This class is designed to list the contents of a package or partial package  name. This class is initialzed with a name that can be,

                1. Full Package name. ("java.lang.")

                2. Prefix of package name. ("java.")


Based on case it lists either the type names or next part of the package  name respectively.


This class acts as a factory to create a ClassInfo object. See for more information about ClassInfo class. There a 2 types of classinfo identified. They are,

            a) Reflection ClassInfo

                        ClassInfo implementation that gives a type's  information using the   

                       Java’s Reflection mechanism. 

           b) Local Class Info                                                                                       

                          ClassInfo implementation that gives a type's information by parsing the type’s  java source file.


 This class tries to get a class info in the following order,

                First Assumption

                         Given type 'TypeA' is a class defined in current editing file. 

                Second Assumption

                           Given type 'TypeA' is a public class defined in one of the java files in            current Folder 

                Third Assumption

                         Given type 'TypeA' is a runtime loadable class available in classpath.         

                Fourth Assumption

           Given type 'TypeA' is a class defined in one of the java files  in the             current folder (it need not be a public class).


Based on the assumption the class tries to creates the ClassInfo as  following,

                A hit for First, Second and Fourth Assumptions results in

                LocalClassInfo. A hit for Second Assumption result in a ReflectionClassInfo.



This  class implements the ClassInfo interface to provide information about

a class using reflection mechanism.



This class implements the ClassInfo interface providing class information

parsing the java source file.



 This class acts as a factory to create a DocReader. See to

 know about the DocReader interface.


 There are 2 types of DocReader implementation available


                                DocReader that gives documentation parsing the HTML file.


                                DocReader that gives documentation parsing the source file.


This class instantiates one of the DocReader.



This class implements DocReader interface and provides documentation

information parsing a HTML file.



 This class implements DocReader interface providing the documentation info

 by parsing the java source file.





The source for javaft.dll and insen package can be downloaded from here.


Feedback / Bug:

If there is bug, suggestion, question, compliment please post it to


To Swarna and Shrishti for thier continuing support and putting up with me for the time I worked in this project. To Bert Roos who taught VIM (and many good things) to me.

Return Home