problems with auto-complete #102

Closed
xiaohanyu opened this Issue May 3, 2013 · 7 comments

Comments

Projects
None yet
5 participants
Contributor

xiaohanyu commented May 3, 2013

hi,

I'm a newbie user of eclim + emacs + auto-complete, and my dot emacs about eclim is as follows:

(add-to-list 'load-path (expand-file-name
                         "~/.emacs.d/el-get/eclim/"))
(add-to-list 'load-path (expand-file-name
                         "~/.emacs.d/el-get/eclim/vendor/"))
(require 'eclim)

;; Variables
(setq eclim-auto-save t
      eclim-executable "~/.eclipse/org.eclipse.platform_4.2.0_1543616141/eclim"
      eclimd-executable "~/.eclipse/org.eclipse.platform_4.2.0_1543616141/eclimd"
      eclimd-wait-for-process nil
      eclimd-default-workspace "~/workspace/"
      help-at-pt-display-when-idle t
      help-at-pt-timer-delay 0.1
      ac-delay 0.5
      )

;; Call the help framework with the settings above & activate
;; eclim-mode
(help-at-pt-set-timer)

;; Hook eclim up with auto complete mode
(require 'auto-complete-config)
(ac-config-default)
(require 'ac-emacs-eclim-source)
(ac-emacs-eclim-config)

(add-hook 'java-mode-hook
          (lambda ()
            (remove 'ac-source-clang 'ac-sources)
            (eclim-mode t)))

But when I use auto-complete with eclim, auto-complete provides detailed information about methods, and when I press =Enter=, auto-complete leaves things like this:

String s = "hello, eclim";
s.indexOf(int ch, int fromIndex) : int - String;

How can I make auto-complete just leave =indexOf= instead of =indexOf(...) : ....", things like that?

Thanks very much!

I would also like to know this.

Contributor

expez commented May 4, 2013

emacs-eclim integrates with yasnippet. Just like eclipse, it shows you the function signature, as a reminder, and you then TAB through each field to provide the arguments to your function call.

If you want to remove this feature, and type in everything yourself manually, then you're likely to have to write that code yourself.

Contributor

xiaohanyu commented May 4, 2013

But when I type TAB, emacs locates the point to the end of the whole

 s.indexOf(int ch, int fromIndex) : int - String; -->Point Here after TAB<--

Anybody know why?

You need to use the key associated to the ac-complete function (by
default RET or enter). This function performs the action that is
associated to the auto-complete source, which is what you are looking
for. Tab executes ac-expand, which only fills in the text of the
completion item but does not perform the action. On my system, the
enter key was only inserting a newline instead of performing the
completion, but I was able to work around that by binding C-j to
ac-complete with the following line:

(define-key ac-menu-map (kbd "C-j") 'ac-complete)

So I just use C-j instead of enter for the eclim completions. Hope that
helps.

Collaborator

fred-o commented May 6, 2013

It sounds like you don't have yasnippet installed, or that eclim-use-yasnippet is set to nil for some reason.

However, I've also noticed a bug that has the symptoms you describe that pop up every now and then. It seems to be timing-dependent, which makes it hard to track down. It could be this bug you're seing, but in that case it shouldn't occur all the time.

I have no issues any more. Pressing return removes the extra content. TAB will "insert" it but pressing enter will remove it.

Contributor

xiaohanyu commented Jun 19, 2013

@HornetBlack @fred-o Thank you all, now I know what's the problem. Press ENTER after TAB expand will make auto-complete work. I just use it the wrong way, sorry.

Please close this issue.

@fred-o fred-o closed this Jun 20, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment