vscode

Quiet in here? Check #calva-dev out :smiley:
Janne Sauvala 2021-04-10T09:14:58.048200Z

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 Sauvala 2021-04-10T12:43:00.051400Z

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

pez 2021-04-10T12:45:43.052400Z

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 Sauvala 2021-04-10T16:05:00.056300Z

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: https://github.com/sauvala/cljs-vscode-extension. With this setup I was able to use REPL and the vscode extension api to develop it

pez 2021-04-10T16:09:42.059400Z

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.

pez 2021-04-10T16:11:24.061300Z

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 Sauvala 2021-04-10T16:16:52.062600Z

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

pez 2021-04-10T16:23:14.064100Z

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 Sauvala 2021-04-10T16:30:01.065800Z

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 Sauvala 2021-04-10T16:30:22.066100Z

But it didn’t quite work right all the time

pez 2021-04-10T17:42:28.066600Z

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