Fork me on GitHub
Janne Sauvala09:04:58

Has anyone been able to open up a REPL to the vscode debug instance that you use when developing an extension? I have a basic setup where shadow-cljs compiles cljs to JS and I can load that to the debug instance but I miss repl.

Janne Sauvala12:04:00

I got it working. I didn’t realise that I had to first reload the the extension code in the debugger session and that creates the repl on the vscode side. Then I used Calva to connect to the shadow-cljs cljs repl and code evaluation works with vscode API. Without first activating the extension I just got an error message that no JS runtime was specified when I tried to eval any code


Not fully following, and I am super interested in this. Can you describe a bit step by step what you did? And also some more context. 😃

Janne Sauvala16:04:00

You probably have solved this already and it is totally clear for you after you see my example. Sorry for badly worded explanation 😄 I wanted to get REPL experience when developing vscode extensions with cljs. I documented the steps here: With this setup I was able to use REPL and the vscode extension api to develop it


Ah, i started to think you had got the vscode debugger working with CLJS, something I have almost, but not quite, had working. I’ve spent uncountable hours on it, because when developing VS Code extensions there is a lot of integration points, so the ratio impure/pure is quite high and I need a debugger more than in regular Clojure/ClojureScript development.


However, it is awesome that you’ve made that example repo with a great README to go with it. I’ve been wanting to demo the setup for the VS Code team, and this will come in perfect.

Janne Sauvala16:04:52

Getting the debugger to work would definitely be nice but I can image it’s not that easy 🙂


In theory it should just work. I don’t remember the details, but a culprit was that the source maps where not good enough, which might have been fixed since then.

Janne Sauvala16:04:01

Hmm okay. I just added (js-debugger) to one of the functions and the debugger actually stopped there but it was some other file. It took some tries but finally the debugger stopped in the right file inside shadow-cljs’s cljs-runtime folder

Janne Sauvala16:04:22

But it didn’t quite work right all the time


Ah, thanks for testing that. Even if it seems that it is as flaky as it used to be. 😃