nrepl / weasel

ClojureScript browser REPL using WebSockets
The Unlicense
324 stars 35 forks source link

Completion is semi-functional in weasel-example #36

Closed nahuel closed 9 years ago

nahuel commented 9 years ago

Start the ws-repl on a bare lein repl using the included weasel-example (not a cider session or anything like that), connect the browser and then type:

(def myvar 2)
myv<TAB>        ;;=> nothing is completed
cljs<TAB>       ;;=> but this completes ok
cljs.us<TAB>    ;;=> cljs.user namespace is completed ok but no vars are showed. 

So it seems like there is something broken.

tomjakubowski commented 9 years ago

Just curious, do you get expected completions using the NodeJS REPL or Austin or something like that?

tomjakubowski commented 9 years ago

By the way, completion using something like CIDER or vim-fireplace should just work if you're using cider-nrepl

nahuel commented 9 years ago

No, I'm not using NodeJS or Austin, just weasel and a bare lein repl on a plain console with the cider-nrepl plugin. I expected to be able to get CLJS completions using TAB, my steps:

git clone https://github.com/tomjakubowski/weasel.git
cd weasel/weasel-example/
lein cljsbuild once
lein repl
(require 'weasel.repl.websocket)
(cemerick.piggieback/cljs-repl :repl-env (weasel.repl.websocket/repl-env))
;; cljs.user=>  prompt is shown
;; Now open weasel/weasel-example/index.html in a browser
(def myvar 2)
myv<TAB>        ;;=> nothing is completed
cljs<TAB>       ;;=> but this completes ok

Now I realize the completions I'm getting are from the Clojure JVM environment, not from the CLJS browser one, even if the prompt shows "cljs.user=>" and the expressions I enter in that prompt are evaluated in the browser. Seems a little confusing.

tomjakubowski commented 9 years ago

I don't think there's anything actionable on Weasel's part here. Changes would need to be made somewhere lower in the stack to support hijacking reply's tab-completion.