On talking to Chas,
https://github.com/cemerick/piggieback/issues/22

it seems like the right approach is to reify ac-nrepl's use of eval into a
real "complete" op, and reimplement it to use that, then a common
middleware can either use clojure's environment (clojure-complete) or
piggieback's compiler state to implement the appropriate auto-complete
based on the active repl.

The issue here is that clojure's auto-complete takes the JVM state as an
implicit parameter, whereas cljs-complete requires an 'env' arg that has to
come from somewhere (piggieback has a var that keeps track of repl session
state).  Ac-nrepl shouldn't be able to eval code, that means it's being
coupled to the JVM state, which won't do for cljs or other sorts of
repls-on-repls.



On Mon, Jan 13, 2014 at 9:03 AM, Gary Trakhman <gary.trakh...@gmail.com>wrote:

> I've released a cljs port of clojure-complete:
>
> Here's the mailing list announcement, also inlined.
>
> https://groups.google.com/forum/#!topic/clojurescript/Dt1s4laHFXc
> cljs-complete, A Clojure library designed to auto-complete clojurescript
> based on cljs compiler state.
>
> - With leiningen:
>      [cljs-complete "0.1.0"]
>
> - Usage
>
> ;; env is pulled from cljs compiler state
> => (completions @cljs.env/*compiler* "al" 'cljs.core)
> ("alength" "alter-meta!")
>
> This is meant to hook into piggieback, that'll be the next thing I try. I
> hope I can get some help with the hairy emacs bits :-).
>
>
> On Tuesday, January 7, 2014 1:54:27 AM UTC-5, Bozhidar Batsov wrote:
>>
>> I'm cider's maintainer. The problem with code completion for
>> ClojureScript is that the default mechanism is based on the Clojure-only
>> library https://github.com/ninjudd/clojure-complete. As I don't use
>> ClojureScript I haven't paid much attention to it so far. If there is a
>> similar library for ClojureScript I might add support for it. Btw, cider
>> will also pick up any nREPL middleware that provides a "complete" op - if
>> there is a ClojureScript nREPL completion middleware it can be used with
>> cider even now. Ideally at some point we'll have unified middleware
>> supporting both Clojure & ClojureScript.
>>
>> On Sunday, January 5, 2014 10:30:44 PM UTC+2, Alexandru Nedelcu wrote:
>>>
>>> Hi,
>>>
>>> I can’t get auto-completion or jumping to the definition of a function
>>> in Emacs, while working with ClojureScript. Is this a limitation of Emacs’
>>> Cider <https://github.com/clojure-emacs/cider> plugin?
>>>
>>> I managed to get nRepl working by using the awesome 
>>> com.cemerick/austin<https://github.com/cemerick/austin>plugin for lein 
>>> (besides including the plugin in
>>> project.clj I’ve got no other special configuration). So to work with
>>> ClojureScript, from inside an nRepl session, I execute the following (not
>>> sure if this is right):
>>>
>>> (cemerick.austin.repls/exec :exec-cmds ["google-chrome"])
>>>
>>> In Emacs I do the same thing, by first starting the repl with
>>> cider-jack-in and then I execute the above command. Compiling the
>>> current buffer works (C-c C-k), I can also send expressions for evaluation
>>> to the repl (C-x C-e).
>>>
>>> However, as I said, auto-completion doesn’t work and neither does
>>> jumping to the definition of a function. Is there any way to get these
>>> features while working with ClojureScript in Emacs? Or maybe in another IDE?
>>>
>>> Thanks,
>>> --
>>> Alexandru Nedelcu
>>> www.bionicspirit.com
>>>
>>> PGP Public Key:
>>> https://bionicspirit.com/key.aexpk
>>>
>>  --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to