简体   繁体   中英

How to let auto-complete use java mode in Jdee mode?

guys

I installed jdee in my emacs and it works well, but I fins that it cannot active auto-complete.

Example: When I open a new .java file in emacs, and I input "imp", auto-complete cannot active.

The problem is .java file open in emacs in "jdee-mode" because jdee. But the auto-complete only work on "java-mode", the evidence is AC works well when I change the jave-mode filename, which in AC/dict, to jdee-mode.

So I thought two solutions about this:

  1. make AC use java-mode even in jdee-mode
  2. make emacs change the filename of java-mode to jdee-mode after every update jdee.

Dose anyone know how to make them? Or has better solution?

Thank you!

JDEE doesn't support autocomplete nor company-mode, yet. But it does have its own completion mechanism. To use it create JDEE project file (prj.el) in your project directory, with the following content:

(jdee-project-file-version "1.0")
(jdee-set-variables
 '(jdee-compile-option-classpath (quote ("./out")))
 '(jdee-compile-option-directory "./out")
 '(jdee-built-class-path (quote ("./out")))
 '(jdee-db-option-classpath (quote ("./out")))
 '(jdee-run-option-classpath (quote ("./out")))
 '(jdee-run-working-directory ".")
 '(jdee-sourcepath (quote ("./src"))))

"./out" is the path to compiled classes. "./src" is the path to your sources. JDEE requires JDEE-Server that is at GH ( http://github.com/jdee-emacs/jdee-server ). Then you can go to a Java file in your project and do "jdee-complete-menu". This is for JDEE from MELPA .

您可以将jde-mode添加到ac-modes以使AC也可以与jde-mode

(add-to-list 'ac-modes 'jde-mode)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM