clojure-emacs/cljs-tooling

Combine completion candidates with metadata regarding them

Closed this issue · 5 comments

Emacs has a feature that allows you to annotate a completion candidate with addition information - e.g. the type of the candidate (function, macro, interface, etc). You can see the feature in action for Emacs Lisp completions. For this to effectively used, however, it'd be beneficial if one could retrieve a completion candidate together with some metadata regarding it (perhaps the type and the ns/package of the candidate, maybe others make sense as well), so avoid having to do one of two things:

retrieve the metadata for each candidate individually (which is slow)
retrieve all candidates and then do a second function call to retrieve the metadata for all of them
Obviously this is not a must-have feature, but it'd be nice to have something like this in tools like CIDER. I'm also not quite sure if packages like compliment should handle this or their clients, but I wanted to start a discussion on the subject.

I've opened a similar issue for compliment (alexander-yakushev/compliment#16).

I agree, we should probably return a list of info maps out of cljs-tooling,
then let cider figure out what it wants.

On Tue, Sep 9, 2014 at 5:21 AM, Bozhidar Batsov notifications@github.com
wrote:

Emacs has a feature that allows you to annotate a completion candidate
with addition information - e.g. the type of the candidate (function,
macro, interface, etc). You can see the feature in action for Emacs Lisp
completions. For this to effectively used, however, it'd be beneficial if
one could retrieve a completion candidate together with some metadata
regarding it (perhaps the type and the ns/package of the candidate, maybe
others make sense as well), so avoid having to do one of two things:

retrieve the metadata for each candidate individually (which is slow)
retrieve all candidates and then do a second function call to retrieve the
metadata for all of them
Obviously this is not a must-have feature, but it'd be nice to have
something like this in tools like CIDER. I'm also not quite sure if
packages like compliment should handle this or their clients, but I wanted
to start a discussion on the subject.

I've opened a similar issue for compliment (
alexander-yakushev/compliment#16
alexander-yakushev/compliment#16).


Reply to this email directly or view it on GitHub
https://github.com/gtrak/cljs-tooling/issues/12.

Candidate name, type and ns should all be trivial to return - but what ns should be returned for special forms? Will cljs.core suffice?

Will cljs.core suffice?

Yeah, I think that special forms are usually considered part of the core ns.

I'm not sure what other data people might like to see as a completion annotation. (I'm planning to make this user customizable in CIDER and show only the type by default, but providing a few examples of adding more data like the ns to the annotation).

I pushed a snapshot release that contains this for 0.1.5-SNAPSHOT. Seems like there's still churn upstream cider and compliment wrt these changes?

@gtrak should all be working now if you get latest cider-nrepl 0.9.0-SNAPSHOT and cider MELPA :-).