Fork me on GitHub
#calva
<
2019-05-30
>
pez09:05:51

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?

pez11:05:36

Never mind! I found it. aw_yeah

pez11:05:46

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.

pez15:05:30

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.

pez15:05:32

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.

hoppy15:05:12

is this still 'dev' branch in git?

pez15:05:44

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

orestis15:05:05

I did - still can’t connect 😞

pez15:05:13

What happens?

orestis15:05:33

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”

pez15:05:08

Have you loaded the file before trying eval?

pez15:05:30

How recent was this build you tried?

orestis15:05:44

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

orestis15:05:54

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

pez15:05:27

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

orestis15:05:12

There’s some delay…

pez15:05:16

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

orestis15:05:22

OK, trying with jack-in seems to be working

orestis15:05:38

Is there a command to evaluate the whole file?

pez15:05:59

ctrl+alt+c enter

orestis15:05:00

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

pez15:05:23

That’s intended behaviour.

orestis15:05:39

Yep, looks good

orestis15:05:51

Trying afresh, to connect to a running repl this tim

metal 1
orestis15:05:19

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

orestis15:05:46

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.)

pez15:05:48

Yes, but there should be a None option now.

orestis15:05:58

Ah, perhaps I missed that. Trying again

orestis15:05:06

Let me make sure I have the right version installed.

pez15:05:51

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.

pez15:05:41

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

orestis15:05:45

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?

orestis15:05:12

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

orestis15:05:22

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

orestis15:05:04

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

orestis15:05:36

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

pez15:05:09

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. 😃

pez15:05:35

Appreciate this quick smoke test a lot!

pez15:05:49

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…

orestis16:05:58

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.

pez16:05:03

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

orestis16:05:49

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

calva 1
hoppy16:05:16

@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

❤️ 1
pez18:05:29

@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.

pez18:05:14

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.

hoppy19:05:53

@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

pez22:05:36

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

guillaume22:05:14

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?

guillaume22:05:35

for instance (conjure/mocking ...)

pez22:05:51

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

guillaume15:05:51

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.

pez16:05:54

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…

pez16:05:26

The new formatter lives in the repl-indicator project, in this file: https://github.com/BetterThanTomorrow/repl-interactor/blob/master/src/client/indent.ts

pez16:05:10

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

pez16:05:32

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…

pez16:05:14

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.

pez16:05:21

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

guillaume23:05:25

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

pez22:05:20

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?

pez22:05:06

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

kstehn22:05:02

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 🙂

pez22:05:42

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

pez22:05:50

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

pez22:05:26

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

kstehn22:05:54

yeah of course 🙂

❤️ 1
pez22:05:30

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

kstehn22:05:19

jep but my testing should be quick so its fine 🙂

kstehn23:05:56

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 🙂