Fork me on GitHub
#calva
<
2020-07-30
>
mail98501:07:06

So, I tried to jack-in to an app project I made a few minutes ago with https://github.com/filipesilva/create-cljs-app and I get this error:

Aborting. No valid shadow-cljs build selected.
Any ideas? I'm just now learning my way around the tooling so I'm not really sure how to go about fixing this.

mail98501:07:31

I know create-cljs-app is not very widely used, but it just bootstraps a simple app setup with shadow-cljs, reagent, and figwheel (here's https://github.com/filipesilva/create-cljs-app/tree/master/template) so it seems like it would be compatible. To anyone who can point me in the right direction - thanks in advance!

pez06:07:55

From the error message it looks a bit like you are not selecting a build when prompted. Can you describe your steps to reproduce the problem?

mail98511:07:21

1. npx create-cljs-app some-app 2. cd some-app && npm run start 3. App should open in web browser 4. Open folder in VSCode, ctrl+alt+c. ctrl+alt+j to jack in. 5. Will prompt for project, select "app" 6. Gives the error

mail98511:07:05

Ah, I think I found the problem though. Need to use the "connect to running repl" option instead

pez11:07:55

Ah, now I see. It's the npm run start. Skip that and it should work.

pez11:07:47

You might need to open the app in the web browser yourself, though.

mail98511:07:06

Is there any advantage to using jack-in vs connecting to a running REPL? I'm doing that latter now and it seems to be working great so :man-shrugging:

pez11:07:17

With Jack-in Calva will provide its dependencies. w/o jack-in, you will need to provide that. So if Calva's requirements changes, things will not work until you update your project.

mail98511:07:29

> if Calva's requirements change I'm a total newb to this style of development, could you give an example of when this might happen?

pez12:07:40

It can and does happen at any time. Sometimes because we want to introduce a new feature, sometimes because we want to benefit from bug fixes upstream. And Calva will often seem to work anyway, just subtle bugs here and there. You can't believe how often we help people with these issues. (And I assume a lot of people never even solve them, because they don't ask us for help.) A lot of people keep their projects updated with Calva dependencies themselves, so it is not a no-go, by far. But for most people it is just an unnecessary source of error.

mail98512:07:36

Gotcha. I'll look into getting the jack-in working properly later. Thanks for your help!

brandon.ringe17:07:49

@ On a similar note, for example, if you don't have cider-nrepl in your shadow-cljs.edn deps, and you start the repl without jackin, go-to definition will not work in the editor, because that depends on cider-nrepl, and calva injects that for shadow projects via jack-in.

brandon.ringe17:07:29

This is somewhat noted in the shadow docs -> calva section though

glebovmaksim06:07:52

Unfortunately 2.0.111 is unusable for me =( The output window now opens automatically after loading vscode and .calva folder is automatically created (even before jack-in). Imo, this is super-frustrating: - Does not play well with multiple projects in a directory (eg. monorepo or VSCode workspace) and/or VSCode Remote Extensions. I ended up with two or more instances of .calva folder when opening project in different contexts (e.g. monorepo root and docker container root) and broken jack-in. - The output window is not needed if I only want to change readme file or docs. Closing it everytime is kind of annoying. I had to roll back to the previous version for now.

pez07:07:46

Previous, as in .110?

pez07:07:05

The changes in .111 are mostly to stablize the behaviour, so I can't really roll them back, but I might be able to avoid some off the effects making it bad for you there. Though I need to understand the problem better first...

glebovmaksim07:07:20

Could it be that Calva is not able to reliably determine clojure project (leiningen) root before jack-in? For me this new behaviour is like an unexpected side-effect after opening vscode.

glebovmaksim07:07:53

Noticed that Calva hangs on jack-in after removing .calva folder.

pez07:07:43

The project root thing is particularly stateful and brittle.

pez07:07:47

I wanted to avoid popping up Calva says, so moved some messaging about how to connect the REPL to the output window. Hence why it shows before jack-in. But maybe in some cases this won't work...

pez07:07:28

Can you file an issue describing your workflow briefly and how this new behaviour clashes with it? I'll start looking into what can be done about it.

glebovmaksim07:07:32

Will do. Thank you!

pez08:07:39

I created the issue now. Needed the handle. 😃 Please feel free to amend to it. Especially if it looks like I have misinterpreted the issue.

glebovmaksim09:07:30

No output window on startup, but jack-in does not work and .calva folder is not created... Will take a closer look a little bit later 🙂

pez09:07:36

OK. So I think I can reproduce it now. You get a ”Jack-in done.” in Calva says, but then nothing more happens?

glebovmaksim10:07:32

Yes, that's right.

pez10:07:48

You are suffering because I've made this part of Calva so stateful. I will need to address that soon. But for now I think I have fixed it (by introducing even more state, haha).

pez12:07:40

Released it now. 😃 Betting on that my repro was right. Let me know if it still doesn't work for you.

glebovmaksim16:07:22

Sorry for delay. It works now! Thank you!

alefeans213:07:31

HI ! The shortcut alt+ctrl+c ctrl+alt+e stills showing the results on the "old" REPL screen. Is it the expected behaviour on 2.0.112 ?

pez13:07:27

Hello, @alefeans2. Yes, I guess that is expected behaviour as long as the old REPL window still exists. But, yeah, quite confusing. We should hurry up removing that window.

pez13:07:24

Anyway, in most cases, @alefeans2, you can now save yourself some finger bending by just using ctrl+enter instead. 😃

alefeans213:07:15

Thanks for the quick answer ! I'm already using this one 🙂

alefeans214:07:53

Sometimes, we don't want the results to appear right next to the evaluated expression, but only on the REPL window. But I got it anyway and will wait for the next releases !

pez14:07:37

Press esc and the inline display is dismissed.

pez14:07:21

If the output window is visible, maybe we could skip displaying inline... @, whatchasay?

brandon.ringe17:07:28

🤔 Would need to be careful here. I'm not sure most people would want to not have the inline display even if the output window is visible. I doubt it would hurt much though, could probably be easily reversed if we get complaints.

brandon.ringe17:07:28

I would say we could add a setting, but I think I know you're response @pez 😂

brandon.ringe17:07:55

And I don't completely disagree

pez17:07:23

I've already added a setting today. 😀

alefeans218:07:57

Why not have both options ? Display inline and display in the REPL window ? 😛

alefeans218:07:26

Two different shortcuts (like the past releases)

brandon.ringe19:07:50

I think minimizing keyboard shortcuts where possible will save on user cognitive overhead and developer maintenance down the road. It's worth a try to minimize here

pez20:07:28

I'm thinking like this. When you evaluate a form, you are interested in the results. Wether they are printed inline or somewhere else is secondary. If the results window is visible, it is reasonable to assume that you will be looking there for the results. If it is not, it is reasonable to assume that you do not find it worth having the window taking up space. Then we show the results inline instead.

brandon.ringe22:07:32

Makes sense to me

pez20:07:06

Dear Calva friends. Since we have removed the results display in the evaluation hover, and it showed to be a used feature, this PR build is introducing a new way to peek at the rich results: a definition hover. So if you install this VSIX - https://6946-125431277-gh.circle-artifacts.com/0/tmp/artifacts/calva-2.0.113-693-result-definition-hover-1e9fd78d.vsix - you will be able to have a workflow like: 1. Evaluate a form. 2. See the first line of the results inline. 3. Press alt+f12 to get a peek widget showing the results as it is printed in the output window. It can look a bit like so:

orestis07:07:49

Ohh I’ll have a look, I like the preview window but missed the inline results. A question: can I make the evaluation result show below the code if the window is narrow? A lot of times I have to horizontally scroll to see the result.

pez08:07:53

You mean the inline eval results? If so, no. It's a css :before style applied to the last character in the evaluated form.

orestis14:07:26

ah. that’s unfortunate. Couldn’t it be an actual “panel” inside the editor?

orestis14:07:32

Like this: (this is from the github PR extension)

orestis14:07:12

Pressing the little up arrow on the right dismisses the panel.

orestis14:07:31

I feel like I sound demanding, so I will state it another way: would you be opposed to the inline results looking like this?

orestis14:07:55

I haven’t done any Calva work despite mentioning a few times already, perhaps this time I will actually get around to setting up a Calva dev environment.

pez14:07:30

That looks super interesting! I wonder how that is done. Please feel encouraged to give it a shot.

pez14:07:13

And you do not sound demanding at all. I am super happy to see ideas about improvement floated around. The current inline display is far from what I would want them to be.

slack130422:08:13

@pez I'm not seeing the behavior expected from peek definition based on the gif. possibly relevant: • installed vsix via command line and had to use --force since there was a newer version available • specific box tested on was windows 10 + lein project under wsl (can test on my linux box if this bit matters) • I use the vim extension I used the foo bar example code just in case, but I'm seeing this with everything. Hitting either the binding (alt f12 on this computer) or right clicking and getting to peek defintion just results in it showing the code definition only. I never see it bring up anything from the output file. Does my cursor need to be in a specific place for this to work properly? I was using alt enter to send the form.

pez22:08:00

@, thanks for testing the VSIX! We've updated it a bit since I posted that link. Can you try the latest build and see if it behaves better? https://7099-125431277-gh.circle-artifacts.com/0/tmp/artifacts/calva-2.0.115-693-result-definition-hover-6b176352.vsix

pez10:08:04

It is now released, so you can use latest Calva. There's a mention in the docs too: https://calva.io/output/#peek-at-results

pez10:08:37

Please let me know if it keeps not working.

slack130422:08:50

@pez in retrospect, the following might have been what was happening with the other version and I just didn't notice... For something like (parse-zone-code-line test-string), with my cursor on any character other than the opening parentheses, it wants to show me the definition of the parse function earlier in the file instead of the definition from output.repl-file. I'm still able to access the output definition but it takes 2 clicks (since it always seems to want to start with it folded (see arrow in the screenshot)): one click to expand the output.repl-file listing, another to click on the results. Same behavior in windows and linux. Vim extension on both. Is there any way for it to force preferring the output repl file definition? As it is now, I'd probably prefer to just adapt to learning the ctrl alt c o for the output window instead.

pez22:08:46

It might be possible to skip providing the symbol definition when there is an output one. Not sure that is very good though...

pez20:07:36

Might be extra useful for small screens when you have the output window in the same editor column as your source files.

pez20:07:41

@glebovmaksim You're using the output window like that, right?

glebovmaksim21:07:52

Right! I'll play with it tomorrow (getting late here). Looks super interesting!

glebovmaksim21:07:03

I think @ may also be interested in this.

brandon.ringe22:07:56

FYI for anyone who may be in a similar situation, the shortcut could be different per distro, but the command is Peek Definition. On my linux distro the keybinding is ctrl+shift+F10.

pez05:07:35

Quite surprising that it would differ. Is go to definition on f10?

brandon.ringe18:07:19

It's F10. Though, I just remembered I am using the VS code version/adaptation from the manjaro linux repository, because the snap was crashing on me sometimes.

brandon.ringe18:07:22

So maybe this version has different keybindings more suitable for manjaro linux

brandon.ringe22:07:31

@pez We should probably note that in the docs

brandon.ringe22:07:54

Not necessarily that specific shortcut, but the command name and that it could be different per OS

brandon.ringe23:07:05

Great job on implementing too!