Is there any specific requirement that I need to get Jack in Running? I’m trying to start a project whose deps.edn file is not in the root directory but nothing happens. It works if I open VSCode in a way that deps.edn is in the root. Is there a way to change this?
I don’t know what is going on. Despite that note in the docs, you are supposed to be able to have a structure like:
- foo
- bar
- deps.edn
- src
- baz.clj
And having baz.clj
open jack-in should work. It does when I try it. Can you create a minimal repro of the problem? That will make it easier to figure out.Yes, I think I can try to make it happen!
@pez Should we update the docs to mention that?
Yes, we should probably try to describe how the project root is determined on this page https://calva.io/workspace-layouts/ and link to it from the connect page.
Made an issue to track it for later
A believe a deps.edn file is required at the root of the opened project. CC @pez
That seems to be the case; I was wondering if there’s a workaround for this
I don't think so. There's a note about that requirement here: https://calva.io/connect/#jack-in-let-calva-start-the-repl-for-you
Quick question: is there a way to specify a namespace to be auto-loaded on jack-in? I’ve been having to manually eval my user.clj
file and can’t seem to find a setting for that. Maybe it’s deps.edn specific?
Doh! I hadn’t added src/dev
to my :extra-paths
key of the :dev
alias! Thanks for pointing this out, it’s working now!
No problem!
You could specify with afterCLJReplJackInCode
Yeah, just tested it and it would work. Inside of settings.json
👉 calva.replConnectSequences
create/edit a sequence and in the object add: "afterCLJReplJackInCode": "(ns my-ns.core)"
Full object was…
{
"name": "Leiningen Ex",
"projectType": "Leiningen",
"cljsType": "none",
"afterCLJReplJackInCode": "(ns my-ns.core)",
"menuSelections": {
"leinAlias": null,
"leinProfiles": [
"dev",
"repl",
"user"
]
}
}
Hm that doesn’t seem to work for my deps.edn project. I see (ns user)
get evaluated resulting in nil
, but it doesn’t seem to actually load the namespace (all of the symbols are still unresolved)
I keep having trouble with shadow-cljs — I start my shadow app with: npx shadow-cljs watch frontend and connect to an existing repl and use the :frontend option — When I try to evaluate something I get: No available JS runtime.
Try having a Clojure file from the project opened when you Jack in.
I tried that already, but it did not make any difference
It’s not a big deal — I have essentially some openfaas functions and each of them has its own directory and deps.end file
If I have a file, dev/user.clj
, and in my deps.edn I have {:paths ["src" "dev"]}
, after I jack-in the vars I define in the user namespace exist.
By default, tools.deps includes the "src" path, so if you have src/user.clj
that file will be loaded even if your deps.edn is just {}
So, you don't need to use a repl connect sequence, this is built in to tools.deps and I think leiningen. The file just needs to be on your classpath.
I'm guessing it's a browser app. Do you have the app loaded in the browser?
If it's a browser app, the browser is used as the runtime, so it needs to be loaded in order for evaluations to work in the editor/repl.
At least, I think I'm understanding that correctly 😄 . I've had a similar issue in the past when doing browser-based cljs dev.