vscode

kokonut 2025-06-09T13:51:38.126889Z

Hi, I have a project repo that contains both CLJ and CLJS code. Is it possible to run two separate VSCode instances so I can run two REPLs at the same time (one for CLJ and one for CLJS)? I've tried running VSCode from the command line with code -n ., but it doesn't work as expected. Any advice on how to achieve this setup? Thanks!

seancorfield 2025-06-09T14:08:11.569379Z

I thought you already got two REPLs with shadow-cljs and Calva supports that?

kokonut 2025-06-09T14:47:19.765159Z

Hmm, if I jack-in on deps.edn (backend) first and then jack-in on shadow-cljs, the first connection with deps.edn gets closed, leaving the following msg in the .calva/output-window/output.calva-repl.

; nREPL Connection was closed
; Jacking in...

pez 2025-06-09T14:53:37.383319Z

So, that is a bit bad documentation on Calva’s side. For legacy reasons, but we should clean it up. Anyway, @darren_minsoo_kim, what I think will work is that you jack-in the Clojure repl as you do today, then Use the Connect command and select shadow-cljs + deps.edn. Your Clojure repl will need to have shadow-cljs dependency ready. Let me know how you fare, please.

pez 2025-06-09T14:55:47.389839Z

What should happen is that you will have Calva connected to both the CLJ and CLJS repl, and Calva will use the file name extension to choose which repl gets what, plus there is a button in the stats bar that will let you toggle which repl handles CLJC files.

kokonut 2025-06-09T15:01:47.156439Z

Sure. I tried but I don't it worked. I pasted REPL trails in case you want to see. But honestly, I don't think having 2 repls in a single vscode instance is a good idea mainly because it will use the same buffer. Even if it is possible, it'd be quite confusing. For example, emacs opens 2 separate buffers and it works. My preferred goal is to have 2 vscode instances for a single project repo. But vscode doesn't seem to allow it.

; Jacking in...
; Connecting using "deps.edn + shadow-cljs" project type.
; You can make Calva auto-select this.
;   - See 
;
; Starting Jack-in: (cd /Users/darrenkim/Work/arcaneflare; clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version,"1.3.1"},cider/cider-nrepl {:mvn/version,"0.55.4"}}}' -M -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware shadow.cljs.devtools.server.nrepl/middleware]")
; Jacking in...
; Connecting using "deps.edn" project type.
; You can make Calva auto-select this.
;   - See 
;
; Starting Jack-in: (cd /Users/darrenkim/Work/arcaneflare; clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version,"1.3.1"},cider/cider-nrepl {:mvn/version,"0.55.4"}}}' -M -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]")
; Using host:port localhost:56474 ...
; Hooking up nREPL sessions ...
; Connected session: clj
; Evaluating code from settings: 'calva.autoEvaluateCode.onConnect.clj'
nil
clj꞉user꞉> 
; Jack-in done.
clj꞉user꞉> 
123
123
clj꞉user꞉> 
; Connecting using "deps.edn + shadow-cljs" project type.
; You can make Calva auto-select this.
;   - See 
;
; Connecting ...
; Reading port file: file:///Users/darrenkim/Work/arcaneflare/.nrepl-port ...
; Using host:port localhost:56474 ...
; Hooking up nREPL sessions ...
; Connected session: clj
; Evaluating code from settings: 'calva.autoEvaluateCode.onConnect.clj'
nil
clj꞉user꞉> 
; Creating cljs repl session...
; Connecting cljs repl: deps.edn + shadow-cljs...
; Starting cljs repl for: deps.edn + shadow-cljs...
; Execution error (FileNotFoundException) at user/eval28362 (REPL:1).
; Could not locate shadow/cljs/devtools/server__init.class, shadow/cljs/devtools/server.clj or shadow/cljs/devtools/server.cljc on classpath.
; Cljs builds started
; Execution error (FileNotFoundException) at user/eval28364 (REPL:1).
; Could not locate shadow/cljs/devtools/api__init.class, shadow/cljs/devtools/api.clj or shadow/cljs/devtools/api.cljc on classpath.
; Failed starting cljs repl for build: :app. Is the build running and connected?
;    See the Output channel "Calva Connection Log" for any hints on what went wrong.

pez 2025-06-09T15:12:00.381199Z

I think that error message means that your Clojure repl does not have the shadow-cljs dependency. You need to add that to deps.edn, and make sure to select the alias at Jack in, if you configure it on an alias. The VS Code equivalent for Emacs buffers is called Editor. You can have how many editors opened in a VS Code window as you fancy. Not sure what “emacs opens 2 separate buffers” means here. VS Code does support having the same folder opened in two separate VS Code windows, by using Workspaces. There is some discussion about this here: https://calva.io/workspace-layouts/

kokonut 2025-06-09T15:54:17.799679Z

Yes, https://calva.io/workspace-layouts/#one-folder-two-windows is what I was seeking. Thanks tons for help.

❤️ 1