calva

Wednesdays you might find @U0ETXRFEW in the Gather Calva space. Invite is https://gather.town/invite?token=GZqrm7CR and the password is `Be kind`.
bringe 2021-01-29T00:11:16.312100Z

Calva version 2.0.156 is out! 🎉 :calva: • Fix: https://github.com/BetterThanTomorrow/calva/issues/969 • Fix: https://github.com/BetterThanTomorrow/calva/issues/976

2
pez 2021-01-29T00:19:29.314100Z

Anyone want to help me test this VSIX, adding some variables to custom command snippets? https://10533-125431277-gh.circle-artifacts.com/0/tmp/artifacts/calva-2.0.157-986-custom-snippets-variables-6783ff1a.vsix From the PR: • $current-form$top-level-form$current-fn (The symbol at call position) • $top-level-defined (The second symbol of the top level form) TODO: • Probably want to use the form at the call position, not just a a symbol • Documentation • Figure about the names of these variables

2
Janne Sauvala 2021-01-29T17:20:47.340600Z

@pez works like a charm! Thanks you, this was just what I wanted 🙂 Was it that I cannot assign custom keybinding to these snippers because of limitations in vscode? It is a little tedious to select those snippets from the list. Luckily vscode remembers the last snippet I used so it is not too bad - I just need to hit enter in the snippet list.

pez 2021-01-29T17:27:24.340800Z

I number the commands for this reason. So maybe remap the default keybinding to something like ctrl+alt+. Then, for running the first command in the list it becomes almost a chord: ctrl+alt+. 1 enter.

pez 2021-01-29T17:28:08.341Z

Actually you don’t need to change the shortcut, but it does get more convenient.

pez 2021-01-29T17:28:37.341200Z

I am now considering changing the default…

Janne Sauvala 2021-01-29T17:38:24.344200Z

It is not possible to bind for example ctrl+alt+t to Tap Current Form snippet?

pez 2021-01-29T17:42:17.346300Z

I don’t think so. Might be some extension that can help with it, but I somehow doubt it.

Janne Sauvala 2021-01-29T17:42:23.346500Z

In Clover that functionality was implemented as vscode “Tasks: Run Task” (https://github.com/mauricioszabo/clover#custom-commands) and it seems you can bind those individual tasks to a custom keybinding but you will not see them in the command palette when trying to search them. I don’t know how you have implemented this feature, do you use that Task approach? 🙂

pez 2021-01-29T17:43:49.346900Z

No, nothing like that.

pez 2021-01-29T17:45:20.347100Z

I think we could expose commands like Run Custom Snippet 1/2/3/etcetera, and then the user could bind those to whatever.

Janne Sauvala 2021-01-29T17:51:02.347400Z

That would be great and would make me 100% satisfied. Now I’m ~85% since I can send tap’s easily but switching between different commands doesn’t feel as fluid as I would wish 🙂

pez 2021-01-29T20:19:40.347600Z

Let’s accept the 85% gain and you can file that as a separate issue? ❤️

Janne Sauvala 2021-01-29T20:21:42.348Z

Yes, I’ll do that ✌️:skin-tone-2:

🤘 1
pez 2021-01-29T20:39:05.348300Z

That said, I think I am going to add a general Tap Current Form command. So maybe your particular use case won’t be dependent on the custom snippets anyway. 😃

Janne Sauvala 2021-01-30T13:19:46.378500Z

That could also work 🙂 I hope you would still keep the new snippets “form api” there since it feels quite powerful for more complex stuff

pez 2021-01-30T13:59:18.379800Z

Oh, definitely. I just merged that PR. Going to abuse it heavily myself. 😀

Janne Sauvala 2021-01-30T20:22:45.389Z

Great! ✌️:skin-tone-2:

pez 2021-01-29T00:19:54.314200Z

@janne.sauvala

pez 2021-01-29T00:21:02.314400Z

Here’s a sample setting I am using for testing:

"calva.customREPLCommandSnippets": [
        {
            "name": "Call Current Form",
            "repl": "clj",
            "snippet": "($current-form)"
        },
        {
            "name": "Call Current Top Level Form",
            "repl": "clj",
            "snippet": "($top-level-form)"
        },
        {
            "name": "Tap Current Form",
            "repl": "clj",
            "snippet": "(tap> $current-form)"
        },
        {
            "name": "Evaluate Current Function Symbol",
            "repl": "clj",
            "snippet": "$current-fn"
        },
        {
            "name": "Call Current Top Level Defined",
            "repl": "clj",
            "snippet": "($top-level-defined)"
        },
        {
            "name": "Eval last result",
            "repl": "clj",
            "snippet": "*1"
        }
    ]

pez 2021-01-29T00:29:36.315600Z

Super smooth to tap> things to Reveal with those variables available. 🚀

Janne Sauvala 2021-01-29T06:40:34.318400Z

That was fast! I’ll take this into use later today or tomorrow by latest :bananadance:

❤️ 1
clyfe 2021-01-29T15:10:55.320400Z

> ERROR: Unhandled REPL handler exception processing message {:op complete, :ns riviera.core, :symbol goog, :id 11, :session ..., :context ... I keep getting these in the repl, and autocomplete hangs. Note I'm I have a folder opened and there are multiple projects in it, each with it's own deps.edn.

pez 2021-01-29T15:36:26.324500Z

Please report it as an issue using VS Code’s issue reporter, @claudius.nicolae.

B Treebeard 2021-01-29T15:38:07.325900Z

Hello all, newbie here. I'm trying to get Calva Jack-in working with Figwheel Main + Electron. I'm using the template from https://github.com/paulbutcher/electron-app. Without Jack-in, Figwheel Main launches an Electron instance when hooked up with build configuration option :launch-js ["npm" "start"] etc. But with Calva Jack-in, this start script configuration option appears to be ignored. Any pointers on how I can hook this up properly will be most appreciated.

pez 2021-01-29T15:48:25.329400Z

Welcome @b.treebeard! I do think it is possible to get Jack-in to do it for you. It is a matter of providing an alias with the right main options. There might be people in the #cider channel who are familiar with what it takes to both launch the repl and something like Electron. And most often, what works in CIDER can be adapted to work in Calva, because Calvados is made from Cider. 😃

pez 2021-01-29T15:51:22.331700Z

I’ll try to find some time to experiment with that template as well.

pez 2021-01-29T17:09:54.339100Z

@b.treebeard I can get the repl connected. A bit quirky, but anyway. Here’s how. I added this alias to deps.edn:

:jack-in {:extra-paths ["src/main" "src/renderer" "src/config/dev" "src/test"]}
(That’s the :dev alias where I have removed :main-opts, because …. well, long story.) At jack in I choose this alias, and then when Calva says that the cljs repl is connected (untruthful, and together with some other misleading info) I open a second terminal in vscode where I run
npm start
Electron starts and when in the terminal I see something like:
[Figwheel REPL] Session ID: 186d3204-4d8e-436a-9332-9b3d025110df
[Figwheel REPL] Session Name: Glenn
Then the repl is connected. The prompt is not updated. But if I evaluate something like 1 there, I get the correct answer and the prompt now shows that it is a real cljs session we are connected to.

💯 1
pez 2021-01-29T17:15:13.340500Z

I am sorry that Calva handles this a bit clumsily, but everything does seem to work once connected.

B Treebeard 2021-01-29T17:35:26.342600Z

@pez Awesome, let me give this a go! (Yeah, I'd gotten as far as removing the :main-opts, because I wasn't seeing the -m nrepl.cmdline ... otherwise.)

B Treebeard 2021-01-29T17:35:51.343100Z

Thanks much, and no apologies necessary whatsoever!

pez 2021-01-29T17:37:36.343600Z

Thanks for showing me the template. TIL.

👍 1
B Treebeard 2021-01-29T17:38:01.344Z

I learnt only yesterday, so you're at most a day behind. 😂

pez 2021-01-29T17:40:27.346100Z

😃 Slightly related is this example project of mine: https://github.com/PEZ/rn-rf-shadow I’ve actually had it target Electron a bit. Have had intentions to include that in the example, but need to figure some stuff out better first.