clojure-emacs / ac-nrepl

[DEPRECATED] Emacs auto-complete backend for nrepl completions
74 stars 11 forks source link

Namespace hint gets expanded into the code #39

Closed abo-abo closed 11 years ago

abo-abo commented 11 years ago

A sequence of (.l auto-complete e gives:

.length [java.lang.String]
.length [java.lang.CharSequence]
.length [java.lang.StringBuffer]
.length [java.lang.StringBuilder]

Which is fine, but starting completion from (.le gives:

(.length [java.lang.

instead of just expanding to (.length.

purcell commented 11 years ago

Sounds more like an issue with auto-complete.el or popup.el. Which versions of those do you have?

abo-abo commented 11 years ago

They're the latest versions from MELPA. Here's the problem: (car (ac-nrepl-candidates-java-methods)) -> ".start [java.lang.ProcessBuilder]".

abo-abo commented 11 years ago

ac-nrepl-delete-java-class-hint is not being called for expansion of (.le.

purcell commented 11 years ago

Hmmm. The behaviour I see is that if I press "TAB" to select the completion, then the hint is inserted too, but if I press "Enter", just the ".length" part is inserted.

Does that match up at all with the behaviour you're seeing?

If not, what does your auto-complete / clojure config look like?

abo-abo commented 11 years ago

I get the same as you. The point is that auto-complete expands .le to the longest common substring of the candidates, which is .length [java.lang..

Of course, if a method named .lenovo existed, there would be no problem: the longest common substring would be .len and auto-complete would show a menu and everything would be fine.

purcell commented 11 years ago

Well, yes, but RET does the right thing: TAB is bound to ac-expand, while RET is bound to ac-complete, so the problem is that ac-expand is not applying the action function, which may be an oversight in auto-complete.

I'll investigate further and see what the options are for fixing this.

abo-abo commented 11 years ago

Do you have ac-expand-on-auto-complete enabled? If not, you're not seeing the behavior that I'm seeing.

purcell commented 11 years ago

Good catch: I have that option disabled, which I guess has let me see more easily what's going wrong.

I'm trying to figure out if it would make sense for auto-complete to call the 'action function upon expansion, in which case I would propose that change upstream. If that's not the case, then we'll have to choose between advising ac-expand (yeuch) or not displaying the hint in the completion dropdown.

(Perhaps @samaaron has an opinion on the latter, since IIRC he added the class name hints...)

purcell commented 11 years ago

Okay, not to worry -- I think I've figured out what to do here.

purcell commented 11 years ago

Fixed. Please let me know if you have any issues with the new version.

abo-abo commented 11 years ago

It works, thanks. And it looks prettier too, since the hint gets a different face.

purcell commented 11 years ago

+1. I didn't know about the 'summary trick, but I figured that other auto-complete sources must have done something similar, and indeed the go-autocomplete code helped me figure out what to do. Open source is a wonderful thing.