How to populate custom class methods using javacomplete

I work under Mac OS X 10.7. I got javacomplete working with a pathogen, but only completes the JDK classes, not the classes I created. When I try to open one of my objects, I get a "pattern not found". Is it really limited to JDK classes? If not, can anyone describe their configuration.

By the way, I tried creating ctags, but it also did not work with javacomplete. However, ctrl-x ctrl-] works fine with created ctags.

+5
source share
3 answers

You need to configure the path to your sources.

From the javacomplete documentation:

3. Set classpath using the following function: >
    javacomplete#AddClassPath('jarfile_or_classes_path')
    javacomplete#DelClassPath('jarfile_or_classes_path')
    javacomplete#SetClassPath('semicolon_separated_string')

    Another two variables will be used if they are existing:
        |g:java_classpath|  global classpath
        |b:classpath|       associated with current buffer

I added the following to my .vimrc to automatically complete Android projects:

if filereadable('AndroidManifest.xml')
    call javacomplete#SetClassPath('/home/tidbeck/android/sdk/android-sdk-linux_x86/platforms/android-17/android.jar:libs/android-support-v4.jar:bin/classes')
    call javacomplete#SetSourcePath('src')
endif

, :

  • javacomplete#AddClassPath jar,
  • ,
+1

javacomplete plugin supertab, , easiet easytags.vim, . .

0

vim .vimrc:

" Only do this part when compiled with support for autocommands.
if has("autocmd")
  autocmd Filetype java setlocal omnifunc=javacomplete#Complete
endif

( ctags). , vim tags .vimrc. . javacomplete.vim, "" .

:

--- autoload/javacomplete.vim   2011-01-30 21:33:46.000000000 +0100
+++ /home/kndl/.vim/autoload/javacomplete.vim   2015-02-12 20:46:48.227465321 +0100
@@ -2510.7 +2510.8 @@
 fu! s: GetClassInfoFromSource (class, filename)
   let ci = {}
   if len (tagfiles ())> 0
- let ci = s: DoGetClassInfoFromTags (a: class)
+ "kndl: Deactivate ctags feature as this does not work. It seems that I am unable to build an accepted tags file.
+ "let ci = s: DoGetClassInfoFromTags (a: class)
   endif

   if empty (ci)
0
source

All Articles