This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-04-15
Channels
- # announcements (2)
- # babashka (41)
- # beginners (10)
- # calva (62)
- # chlorine-clover (70)
- # cider (19)
- # clara (2)
- # clj-http (1)
- # clj-kondo (1)
- # cljs-dev (3)
- # cljsrn (8)
- # clojure (168)
- # clojure-austin (1)
- # clojure-australia (2)
- # clojure-canada (1)
- # clojure-europe (15)
- # clojure-france (9)
- # clojure-nl (3)
- # clojure-serbia (5)
- # clojure-spec (14)
- # clojure-uk (8)
- # clojurescript (14)
- # community-development (30)
- # core-async (42)
- # core-typed (1)
- # datahike (2)
- # datalog (23)
- # datomic (4)
- # emacs (4)
- # figwheel-main (4)
- # fulcro (60)
- # ghostwheel (4)
- # girouette (1)
- # gorilla (7)
- # graalvm (11)
- # heroku (8)
- # integrant (42)
- # jobs (6)
- # jobs-discuss (47)
- # kaocha (7)
- # lambdaisland (2)
- # leiningen (5)
- # lsp (29)
- # off-topic (1)
- # pathom (9)
- # portal (6)
- # re-frame (5)
- # reagent (11)
- # releases (6)
- # remote-jobs (10)
- # shadow-cljs (112)
- # testing (55)
- # vrac (1)
So related to my question yesterday: how does Calva determine whether ClojureScript evaluation via shadow-cljs is available?
First it needs to know it is supposed to be available. If so it clones the CLJ session and converts the clone to a CLJS session. Then it is a matter of shadow-cljs to connect the app to this session, which it will do once the app is running.
It is the same, wether or not connecting or jacking in. The command Copy Jack-in Command line (or some such) will give you the command that Calva uses to start shadow-cljs.
Yeah. Anyway, the question I'm interested in is how Calva knows ClojureScript evaluation is supposed to be available. đ
Tell me what you are trying to do and the steps you use and I might be able to help figure.
I jack in -> Choose "Leiningen" -> start shadow-cljs watch from the REPL -> run (shadow.cljs.devtools.api/nrepl-select :app)
.
Because Calva doesnât know you want CLJS. Youâll need to use a project type which includes that knowledge. I know it failed with âLeiningen + shadow-cljsâ, but you could try with only shadow-cljs
or the lein-shadow
one.
Yes, so my question is, how does Calva determine whether I want CLJS? I'm asking so that I could dig into the Calva code a bit to figure out whether there's a way to make it work without changing the project configuration.
Okay, I see, so that's the only thing it uses for making the determination. That won't help me, then.
shadow-cljs
presumably won't work, because the shadow-cljs nREPL server isn't running yet.
Anyway, this is enough information for me to go on. Tack ska du ha! đ:skin-tone-2:
I see. Maybe you will need to configure a custom connect sequence then. https://calva.io/connect-sequences/
All right! I got it to work by defining a connect sequence like this:
{
"name": "App",
"projectType": "Leiningen",
"cljsType": {
"startCode": "(user/start)",
"connectCode": "(user/cljs-repl)"
},
"isConnectedRegExp": "To quit, type: :cljs/quit",
}
It's not exactly what I want, because I'd prefer to leave the things startCode
and connectCode
do up to the user. Based on the documentation, it sounds like isStarted: true
should do what I want, but if I set that, I can't evaluate from the ClojureScript buffer.I donât quite recall right now what isStarted
is supposed to do, but maybe it is just that, that Calva expects it to be started.
Yeah, that's how I understood it. However, if I set it, it seems to assume that ClojureScript isn't necessary.
Also, this is unrelated, but I just happened to notice that if you evaluate a form such as (do (Thread/sleep 5000) {:a 1})
in one view, then open another view before the sleep is done, Calva shows the inline evaluation result in the currently active view, not the view where you evaluated it.
> Yeah, thatâs how I understood it. However, if I set it, it seems to assume that ClojureScript isnât necessary. It will still try to connect. So the repl really needs to be started. Which it isnât in your case, iiuc.
If you really want it to be manual steps you might get away with something like
"calva.replConnectSequences": [
{
"name": "foo",
"projectType": "Leiningen",
"cljsType": {
"dependsOn": "shadow-cljs",
"startCode": "",
"connectCode": ""
}
}
]
}
Calva will lie about it being a cljs repl at first, but once the commands have been run it should be good.
(Iâm not sure about this, but from what I remember of the implementation, I think it might work.)
I think it makes sense to have some kind of âUser managedâ cljs repl, btw. So regardless if that trick I speculated about works or not, Iâd appreciate an issue about making it a first class citizen option. Thinking it could work a bit like you expected it to work, but it would be choosen something like : > Project type: Leiningen + Manually started ClojureScript REPL
Yeah, I think that might be useful. I don't use Calva myself, though, so I think I'll leave it to someone else to create the issue. đ Only got so many hours in the day...
To me the important thing is to have someone whoâll be willing to test any attempts to fix the issues. So it is nice with someone with stakes in it filing them.
Hi. I am using the "Getting Started REPL" in VSC. I'm trying to use the (source) function to find the code behind the (map) function. I understand that I am to type (source map) into the REPL. I have tried doing this into the output REPL, and into the bottom terminal. What REPL am I suppose to use? As you probably understand, I'm not only new to Clojure but very green in programming. So please keep it simple for me!