Fork me on GitHub
#calva
<
2024-04-03
>
pez09:04:33

Dear Calva-friends: https://github.com/BetterThanTomorrow/calva/releases/tag/v2.0.434https://github.com/BetterThanTomorrow/calva/issues/2488 So what the ^previous^ post shows. It’s added as a command paredit.insertSemiColon without any default keybindings. To enable strict ; mode, bind the command to the key ;. It gets important with the when clause, lest you will disable typing of semi-colons all over. There’s an example of a pretty surgical binding here: https://calva.io/paredit/#a-keybinding-for-protecting-the-structure-from-semi-colon Please take it for a spin and return with feedback! ❤️ 🙏 calva

🙌 1
pez12:04:17

Now thinking it could be improved, inspired by Emacs: https://github.com/BetterThanTomorrow/calva/issues/2490

chromalchemy14:04:16

I like this idea. I rarely use comments later in the line, because it breaks the composability of juggling forms (w paredit). And I’ve mostly switched to using #_ to avoid trailing brackets getting commented out and breaking my code. These updates look to make regular comments much more accessible. Which in turn makes inline code documentation more natural!

chromalchemy14:04:20

After demoing current state, I would definitely prefer this above (emacs) behavior, enabling the ability fluently disable/toggle inline forms/sumbols in the middle of a function, which is a superpower of repl usage. I do this continuously in threaded pipelines.

pez15:04:11

Thanks. I think I can do that. Will have a go at it tonight.

pez21:04:18

Dear Calva friends. https://github.com/BetterThanTomorrow/calva/releases/tag/v2.0.435https://github.com/BetterThanTomorrow/calva/issues/2490 So, with Emacs paredit-mode as inspiration. I adjusted the semicolon command to behave in a bit more useful way. As the intention is often to comment something out, the semicolon keeps doing that, but moves brackets or whole form to the next line if needed.

pez21:04:49

Maybe it can be repeated that you can learn how to enable this behaviour here: https://calva.io/paredit/#a-keybinding-for-protecting-the-structure-from-semi-colon

seancorfield21:04:07

Very nice! Thank you!

🙏 1
pez21:04:54

Let me know how you fare with it. ❤️

seancorfield23:04:04

No complaints so far (and I updated Calva immediately and added the keybinding 🙂 )

Thierry13:04:07

> The exercise for the reader will be to expand the example for conveniently ignoring out binding pairs, such as in let et al, and in maps. Bonus stars available for making it work for things like cond, cond-> , match, and so on. Remember this @pez? I wasted too much time figuring this out and it's far from perfect, but I think I kind of have it 🙃 Getting Maximum call stack size exceeded popups unfortunately tho :melting_face:

pez14:04:52

Nice! Can you share the code? I also get a lot of those call stack messages when hacking in Joyride. But it’s usually in the repl.

Thierry15:04:06

Sure, but its far from great code and really hacky, it's not working for bindings atm for example. Let me get the coed

pez15:04:47

I like hacky. 😃

Thierry15:04:55

I created an adapted version of ignore_form.cljs

Thierry15:04:25

Wat let met make a gist

Thierry15:04:26

Its kinda hard to distinguish a partial string from a binding with my limited knowledge of joyride and cljs

gtbono22:04:25

Is it possible to execute a REPL command on save?

pez22:04:21

Calva doesn’t have any such mechanism. But you could make a keybinding with runCommands that first saves, then runs a Calva custom repl command. There’s some semi recent threads in this channel on both runCommands and how to run custom repl commands via keybindings. I’m afk so can’t help much right now.

Thierry13:04:07

> The exercise for the reader will be to expand the example for conveniently ignoring out binding pairs, such as in let et al, and in maps. Bonus stars available for making it work for things like cond, cond-> , match, and so on. Remember this @pez? I wasted too much time figuring this out and it's far from perfect, but I think I kind of have it 🙃 Getting Maximum call stack size exceeded popups unfortunately tho :melting_face: