I'm trying to figure out how to start a Clojure REPL for a completely blank project. For context, I'm putting together a Clojure workshop, and I don't want to introduce the deps.edn file up front. I'd like to have the attendees do some interactive REPL-ing first.
What I did:
1. I opened a new folder with nothing in it
2. I ran the command: "Start a Project REPL and Connect"
It only gives me options to run a REPL using Babashka, nbb, and joyride. Is there a way I can start a clojure REPL?
I added a blank deps.edn file, and then I got the options involving deps.edn. The clojure command line doesn't require a deps.edn file to be present. Would it be possible to put the deps.edn options in the menu even if there isn't a deps.edn file?
As for the workshop, I can have them create a "mini" project, which will make the deps.edn file for them. Then I'll just ignore it until later.
I'm mainly just wondering if there is a reason to not make the deps.edn REPL options available with no deps.edn file. Or maybe even have it called a "Clojure CLI" REPL or something like that.
@neumann If I recall correctly there is "Start REPL not in project" in Calva
oh no sorry, that was "Connect to a running REPL not in project". I only remembered "not in project", sorry
Ah yes. I was just about to paste a screenshot.
There’s no reason not to include a clojure cli option, afaics. The omission is legacy from back when project files were the only way Calva could know what to include in that menu. But since very long we’ve been adding Babashka as a config-less option and we could easily extend that list.
One thing that does come to my mind is that the linter and LSP won’t work since there isn’t a project root to detect maybe?
Depends on what clojure-lsp defaults to.
I guess you could try it out and see?
It’s a bit opaque to me what happens, but if I simulate it by starting a Babashka repl, (clojure-lsp doesn’t know what kind of REPL Calva is connected to) it seems clojure-lsp defaults to the same source path as clojure would do. But it doesn’t try to start clojure to resolve this and clojure core isn’t on the classpath, afaict. So before anything is evaluated in the repl is started some navigation doesn’t work, but otherwise things work fine.
I think generally things will work mostly fine, especially since Calva uses a combo of static and dynamic ways to provide its features, the user will mostly not notice if clojure-lsp isn’t serving in all cases it would serve if it had used clojure to set things up.