Namespace hint gets expanded into the code
abo-abo opened this issue · 12 comments
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
.
Sounds more like an issue with auto-complete.el
or popup.el
. Which versions of those do you have?
They're the latest versions from MELPA.
Here's the problem: (car (ac-nrepl-candidates-java-methods))
-> ".start [java.lang.ProcessBuilder]".
ac-nrepl-delete-java-class-hint
is not being called for expansion of (.le
.
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?
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.
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.
Do you have ac-expand-on-auto-complete
enabled? If not, you're not seeing the
behavior that I'm seeing.
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...)
Okay, not to worry -- I think I've figured out what to do here.
Fixed. Please let me know if you have any issues with the new version.
It works, thanks. And it looks prettier too, since the hint gets a different face.
+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.