Bozhidar, I had to slightly modify cider-interaction.el to make autocomplete work for cljs.
--- cider-interaction.el 2014-01-18 13:51:28.082131609 -0500 +++ /home/gary/.emacs.d/elpa/cider-0.4.0/cider-interaction.el 2014-01-17 19:06:45.872591834 -0500 @@ -469,12 +469,12 @@ (let ((strlst (plist-get (nrepl-send-request-sync (list "op" "complete" - "session" (nrepl-current-tooling-session) + "session" (nrepl-current-session) "ns" nrepl-buffer-ns "symbol" str)) :value))) (when strlst - (car strlst)))) + strlst))) Here's the current implementing code: https://github.com/gtrak/nrepl-complete/blob/master/src/nrepl_complete/middleware.clj Here's a screenshot: http://i.imgur.com/GmBJ6Fj.png It can't be implemented for cljs on the tooling session without sending the real session id over somehow, it seems this would be wasteful and not a good precedent for other middlewares. I'd appreciate your thoughts. I'm also curious what it would take to make the display pretty like ac-nrepl, which I had to disable. As soon as this stuff is finalized, I'll package everything up nice and make a first release. On Mon, Jan 13, 2014 at 10:21 AM, Gary Trakhman <gary.trakh...@gmail.com>wrote: > Austin's lein-plugin already manipulates project middlewares, so that's an > easy target. Onward! > > > On Mon, Jan 13, 2014 at 10:10 AM, Bozhidar Batsov <bozhi...@batsov.com>wrote: > >> Cider’s completion understands a `complete` op, so the middleware is the >> best approach if you ask me. The only reason that there’s also an eval >> based completion mechanism (the one used by default) is that >> clojure-complete is present as a REPLy (which is used by lein) dependency >> and many newcomers have absolutely no idea what an nREPL middleware is. >> Unfortunately it’s hard to balance initial easy of setup and good design >> decisions. >> >> -- >> Cheers, >> Bozhidar >> >> On Monday, January 13, 2014 at 4:55 PM, Gary Trakhman wrote: >> >> 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 a topic in the >> Google Groups "Clojure" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/clojure/uXtd--Xv6vU/unsubscribe. >> To unsubscribe from this group and all its topics, 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. >> > > -- -- 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.