senny / emacs-eclim

This project brings some of the great eclipse features to emacs developers. It is based on the eclim project, which provides eclipse features for vim.
http://www.emacswiki.org/emacs/EmacsEclim
587 stars 102 forks source link

Completing fields adds to much info #193

Closed kleewho closed 9 years ago

kleewho commented 9 years ago

When completing fields there's additional info about it's type added to the buffer. When inserted in buffer it looks like this:

this.field : String - LibraryA

Additional information about it's type and origin is useful in company popup (or completion buffer) but it should be omitted when inserting to buffer. Information about returning type is already removed for completing functions. Steps to reproduce are quite simple. It seems that the only thing to do is to try to complete any field.

joostkremers commented 9 years ago

This seems related to #148. I have the same problem described there: completion (not just of fields, also function and variable names) inserts all the info given in the popup into the buffer when selecting a completion.

If the completion contains editable fields (such as the arguments of functions), then everything works correctly: only the fields are inserted (the popup usually shows more info) and you can edit the fields. If the info in the popup doesn't contain any fields, everything is inserted and I have to hit (C-)Backspace to remove the superfluous stuff.

I was originally using autocomplete.el, but switched to company.el because someone in #148 said that that solved the problem for them. In my case, though, it's still not working.

Some info:

OS: Elementary OS Luna (based on Ubuntu 12.04) Emacs 24.5.1 emacs-eclim: 20150703.651 (installed from MELPA) eclim: 2.4.1 Eclipse: 4.4.2 (Luna)

I’m using yas-minor-mode in my Java buffers.

kleewho commented 9 years ago

@joostkremers Thanks for the info. Do you know the way to reproduce popup without info you mentioned?

joostkremers commented 9 years ago

No, I don't, unfortunately.

joostkremers commented 9 years ago

I disabled emacs-eclim's own company-mode extensions and am using the default eclim backend provided by the company.el package. It's not as nice (there are no annotations for variables and classes, for example), but at least it doesn't insert too much text into the buffer.

bbelleville commented 9 years ago

The reason for this bug is that company-emacs-eclim-action was only being called if the completion had an annotation. With my pull request it will always be called, and both the length of the completion and the annotation are used to determine beg and end passed to eclim--completion-action. I tested my proposed fix completing methods and fields in various scenarios using company mode, and everything seemed to be working correctly.

kleewho commented 9 years ago

So it was me who introduced this bug. Good to know. Thanks!

joostkremers commented 9 years ago

Great, thanks!