Open austinhaas opened 6 years ago
Thanks for reporting, we should definitely have a cljs REPL type. The one you see above is for Clojure only IIRC.
You can see there are customizations for Planck and Lumo in the code but not for "generic" cljs... probably nobody has ever used it - not even myself with it. I used to use Lumo quite extensively though.
I started adding the CLJS REPL type: https://github.com/austinhaas/inf-clojure/blob/cljs/inf-clojure.el
The eldoc stuff seems to work ok (I've barely tested), but it seems kinda slow. Emacs will hang for a fraction of a second after I move the cursor to a new expression. (Edit: The slowness was due to the browser not having focus).
I also see a problem, both with this new CLJS stuff and with CLJ, where multiple prompts are printed. This may be related to the eldoc stuff, but I'm not sure. For instance, if I move the cursor to a function and for whatever reason the arguments can't be printed, a new prompt might be printed. Sometimes the prompts appear randomly. (I also don't understand why some output goes to the REPL and some goes to the JS console.)
I haven't updated ":package-version" for the new custom functions. I assume that would be set to the next version number.
I'm not sure what to do with inf-clojure-completion-form-cljs: https://github.com/austinhaas/inf-clojure/blob/cljs/inf-clojure.el#L974 The clojure version appears to use a library named clojure.complete. It is assumed that the user is including this library in their project?
Btw, there's some historical context here https://github.com/clojure-emacs/inf-clojure/issues/6
I also see a problem, both with this new CLJS stuff and with CLJ, where multiple prompts are printed. This may be related to the eldoc stuff, but I'm not sure. For instance, if I move the cursor to a function and for whatever reason the arguments can't be printed, a new prompt might be printed. Sometimes the prompts appear randomly. (I also don't understand why some output goes to the REPL and some goes to the JS console.)
Multiple prompts get printed when you eval something with newlines in it. Haven't look at the code in a long time, but back in the day my solution was to simply create long single-line forms for everything.
I haven't updated ":package-version" for the new custom functions. I assume that would be set to the next version number.
Yes.
I'm not sure what to do with inf-clojure-completion-form-cljs: https://github.com/austinhaas/inf-clojure/blob/cljs/inf-clojure.el#L974 The clojure version appears to use a library named clojure.complete. It is assumed that the user is including this library in their project?
It's a lein dependency (by virtue of reply being a lein dep), which means a lot of people have it by default. The other should add this manually for the completion to work. I think at some point @arichiardi also added support for compliment. The cljs completion support should be implemented in terms of https://github.com/clojure-emacs/cljs-tooling
Confirm that the cljs-tooling
lib solves the completion problem in cljs and maybe after the ongoing PR will be also what lumo uses.
Away from the keyboard for our two weeks but when I come back I can validate / help this PR
inf-clojure included non-portable Clojure code, and it automatically enables an eldoc feature which triggers the non-portable code in a Clojurescript REPL.
https://github.com/clojure-emacs/inf-clojure/blob/master/inf-clojure.el#L859
Throwable isn't available in clojurescript. Additionally, when called from clojurescript, this code will throw an error stating that the argument to resolve must be a quoted symbol.
In spite of these issues, I don't think these "eldoc" helper functions should be called if the user doesn't have eldoc-mode enabled. I've resolved the issue by commenting out the call to inf-clojure-eldoc-setup on Line 182: https://github.com/clojure-emacs/inf-clojure/blob/master/inf-clojure.el#L182