You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I basically started out trying to find a fix to this issue.
Could we modify cljs-repl in the following manner to allow loading middleware once the REPL has launched and entered the cljs.user namespace?
(defmacrofunctionize [macro]
`(fn [& args#] (eval (cons '~macro args#))))
(defmacroapply-macro [macro args]
`(apply (functionize ~macro) ~args))
(defncljs-repl"Starts a ClojureScript REPL on top of an nREPL session. Accepts all options usually accepted by e.g. cljs.repl/repl."
[repl-env & {:as options}]
; TODO I think we need a var to set! the compiler environment from the REPL; environment after each eval
(try
(let [repl-env (delegating-repl-env repl-env nil)
on-start (apply list ;; <= HERE!
'(ns cljs.user
(:require [cljs.repl :refer-macros [source doc find-doc
apropos dir pst]]))
(:on-start-middleware options))] ;; <= HERE!
(set! ana/*cljs-ns* 'cljs.user)
; this will implicitly set! *cljs-compiler-env*
(run-cljs-repl (assoc ieval/*msg* ::first-cljs-repltrue)
(apply-macro nrepl/code on-start)
repl-env nil options)
; (clojure.pprint/pprint (:options @*cljs-compiler-env*))
(set! *cljs-repl-env* repl-env)
(set! *cljs-repl-options* options)
; interruptible-eval is in charge of emitting the final :ns response in this context
(set! *original-clj-ns* *ns*)
(set! *ns* (find-ns ana/*cljs-ns*))
(println"To quit, type:":cljs/quit))
(catch Exception e
(set! *cljs-repl-env* nil)
(throw e))))
Yeah, this seems sorta confused. First, the functionalize thing is a little eye-popping; but beyond that, you're talking about middleware, which is a Clojure nREPL thing, completely related to ClojureScript.
I basically started out trying to find a fix to this issue.
Could we modify
cljs-repl
in the following manner to allow loading middleware once the REPL has launched and entered thecljs.user
namespace?Then we could pass middleware like this:
I don't even know if I'm talking sense over here.
The text was updated successfully, but these errors were encountered: