Share your thoughts in the 2024 State of Clojure Survey!

Welcome! Please see the About page for a little more info on how this works.

+1 vote
in Calva by
recategorized by

Hi, I trying to setup editor for Clojure, currently struggling with Calva. I have fullstack project (cljs via Figwheel main) and whe I run repl (jack-in) then both repls get started (Lein + Figwheel Main config), but I cant switch to cljs repl, geting error "Cannot read properties of null (reading 'switchNS')"

1 Answer

+1 vote
by

Hello,

How the project should be started depends on the project. Here's what I do using the Leiningen template for Figwheel Main:

$ lein new figwheel-main hello-world.core -- +npm-bundle --reagent

  1. Follow the instructions to install npm modules and then open the project in VS Code.
  2. Jack-in
  3. Choose ”Leiningen + Figwheel Main” project type
  4. Choose ”No alias”
  5. Choose ”dev” profile
  6. Wait for Clojure REPL to start
  7. Choose to start ”dev” build
  8. Wait for ClojureScript REPL to start, which then opens the ClojureScript app in the web browser
  9. Choose to connect to the ”dev” build
  10. Open the src/figwheel_main_from_lein_template/core.cljs and Load Current File and dependencies
  11. Hack away.

Please let me know if something similar to this works for you. It's hard to give instructions for your project without knowing more about it.

The error message you get seems like a bug that we should fix in Calva. Can you describe what you do when you ”switch to cljs repl”?

by
Hello, thank you for elaborate reply. I discovered that this happens only when cljs code has compilation errors, then in Calva a have only clj shell.
Now before jack-in in Calva I run `lein fig:build` in shell to ensure that it has no errors and compiles, then I open Calva and run jack-in sequence, and all works fine, I get combined shell clj/cljs. Don't  know why but vs-code  stays silent about any cljs compilation errors while jack-in.
...