Fork me on GitHub

I think I am on to what causes ^ #193 ^. But things are a bit too involved for my small brain and I lose the track all the time. If someone has some time to do some pair programming with me, I think we will have this solved much faster. Anyone?


Never mind! I found it. aw_yeah


The source of the bug was quite fundamental. (A bit like cutting of the branch you are sitting on.) I just tried my work project with the new build and it had fixed the problems I had there.


This build also contains something that might make @hoppy happy. 😃 And also some Calva beginner’s help in the REPL window, to ease the starting curve. If you have suggestions for that please let me know, here or by PR.


I choose to use a setting for opting out of the lein-figwheel browser auto-open. Considered a prompt, but it would make the prompt path fo jack-in/connect a bit long and I figured you always want one or the other behaviour for a particular project anyway.


is this still 'dev' branch in git?


@orestis can you try the latest build on your project?


I did - still can’t connect 😞


What happens?


Jack in works — but can’t evaluate a top level form - evaluating from the REPL gives me the dreaded “Cannot resolve symbol + in this context”


Have you loaded the file before trying eval?


How recent was this build you tried?


Heh - after restarting the editor and directly jacking in, I can eval on the REPL.


I guess my initial failed attempt to connect might have messed something up


Or, vscode lies a bit about when reload is needed. Can you try the connect again?


There’s some delay…


jack-in really should start quite afresh, but, yeah, of course there may be bugs.


OK, trying with jack-in seems to be working


Is there a command to evaluate the whole file?


ctrl+alt+c enter


I’m doing ctrl-alt-c + space, I see results in both Calva says and inline


That’s intended behaviour.


Yep, looks good


Trying afresh, to connect to a running repl this tim

metal 4

I still see the “select cljs repl type” when I try to connect to an existing nrepl session


Hooking up nREPL sessions...
Connected session: clj
Creating cljs repl session...
Connecting to: shadow-cljs...
Failed connecting. (Calva needs a REPL started before it can connect.)


Yes, but there should be a None option now.


Ah, perhaps I missed that. Trying again


Let me make sure I have the right version installed.


I do not really dare to try figure these things out for each project. I think I would miss too often, so am using the prompts. The prompts remember your choices though. So from the first time on it is mostly a series of hitting enter on the prompts.


The right version is the one I uploaded just some minutes ago. 😃


I have to first evaluate the file to even get a simple (+ 1 2) to work, I guess somehow the first namespace isn’t selected?


OK, now that this works I’m ready to do some more serious stuff 🙂


And it seemed to have detected my shadow stuff correctly, so I’ll try that later on.


But today is a holiday so I’m helping my wife do some other things! I will check back tomorrow 🙂


Great job figuring all this out — tackling CLJS repls is a huge undertaking. I hope I can help more somehow in the future 😊


Awesome. Holiday here as well. My wife is not too happy I am using it for Calva, but I’l try to make up for it. 😃


Appreciate this quick smoke test a lot!


Maybe I should make auto-loading the files the default behaiour, and people can opt out. It is a bit confusing with nothing working before that load…


I’m confused though on why does there have to be auto-loading of something, when even trying to evaluate a simple form. I’d expect that the first evaluation happens in the user namespace.


That is a very strange and worrying bug. I haven't been able to figure it out.


Here’s to @pez for working on a holiday to get this over the fence 🙂

calva 4

@pez, I report that it seems solid enough, and the not starting browser repl option works like a champ. Still a little obscure to understand when your cljs is done builiding, but that's managable

❤️ 4

@hoppy see if there is output in the Calva Connection Log that tells better about what is going on and if, indeed we spawn of the browser window too early.


Regarding those Jack-in issues on Windows, I am a bit in the dark because I am not using Windows myself. Not sure how I should tackle it.


@pez We are basically launching the browser window as soon as the CLJ build is done, and the CLJS build is just starting. It's probably 90 seconds ahead of time in my situation


Can you post the logs and somehow point at where the browser window is spawned?


There are some macros on which calva fmt will indent with a single space but should be 2 spaces according to clojure style guide. Am I right? Is there a way to tweak this?


for instance (conjure/mocking ...)


There’s no way to tweak that atm. But it shouldn’t be too hard to add support for clj-fmt configs.


Any pointers to where I could modify the formatter code to support this? It’s currently my biggest drawback when collaborating on a project at our organization. Lots of unnecessary indent changes when I edit through files makes it hard to assert the scope of my changesets.


So, there are actually two formatters in Calva, the new one and the old one. The reason for that is that the new one misbehaves more often than the old one, while the new one is still in service in the REPL window. The old formatter is using clj-fmt and can be fed those config maps. The new formatter is accepting the same config format. I have been planning to find some time to fix the new formatter before I add this config feature, but if you are in more of hurry than is allowed by “when PEZ has the time”, please don’t wait for me. I’ll be right back with some code places to have a look at…


The new formatter lives in the repl-indicator project, in this file:


The work here would involve to read a clj-fmt indent config map and merge that onto the default indentRules.


The old formatter is written in ClojureScript and lives in calva/cljs-lib/src/calva/fmt/formatter.cljs. It can be fed the indent config map quite directlly. I’m not sure if it should get it from calva/calva-fmt/ts/format.ts or slurp up a file given a path…


To consume the indent config map for feeding to the new formatter (and possibly to the old, if that path is chosen) you have calva/cljs-lib/src/calva/js_utils.cljs at your service. See calva/nrepl/jack-in.ts:162 for an example of parsing EDN.


I’ll be offline for a while now, but would be happy to have a voice chat when we are both online.


thanks @pez i’ll have a look at this eventually with the new formatter


Windows users. Help a poor Mac dude. I have installed Windows 10 in a VM and installed vscode, java and the powershell clj that I found when googling how to run clojure on Windows. However, Calva can’t find the executable. (Trying with a cli/deps project). How do I start such a project on windows?


I’ll go hit the sack now, I’ll check this space tomorrow. 😃


i would guess that you cant even use cli/deps in powershell directly if that is the case then you have to add the folder where the executable is to the path enviroment 🙂


I can execute clj -h, if that says anything.


But maybe I should go with Leiningen for this particular adventure.


Can you give the latest dev version a spin, @slack1038 ?


yeah of course 🙂

❤️ 4

I guess it's late where you are too. I really must get some sleep now. 💤


jep but my testing should be quick so its fine 🙂


Jack-in works now like a charm 🙂 even with my wierd project setup 🙂 but when i close the cljs-repl window i can still see it in the task manager same goes when i close the window with the running java process (known issue) connecting with a running nrepl works also really nice and i have no problems switching between multiple nrepls 🙂


Any pointers to where I could modify the formatter code to support this? It’s currently my biggest drawback when collaborating on a project at our organization. Lots of unnecessary indent changes when I edit through files makes it hard to assert the scope of my changesets.