calva

zeitstein 2025-03-11T18:21:28.155829Z

If I jack-in and close the editor, my process stays alive (server remains up). I added a shutdown hook, didn't help. If I jack-in but manually kill the process from the Calva Jack-in terminal, it shuts down correctly. If I manually do the steps instead of jacking in then close the editor, it shuts down correctly. Any ideas? šŸ™‚

pez 2025-03-14T09:09:09.597989Z

The jack-in process is managed by Calva. My guess is that VS Code doesn’t give Calva a chance to kill it. What OS are you on? I’m in Mac and seldom see this problem. I know we have some special code for Windows for killing the process. But the shell environment there is pretty crazy.

2025-03-14T09:52:54.448899Z

@mithrandir03 Does "jack-in" mean "start a repl and jack in"? And comparing "jack-in" with "manually do the steps instead of jacking in", what are those steps?

pez 2025-03-14T09:55:22.753799Z

From the description I am guessing that ā€œmanually do the steps instead of jacking inā€ means starting the repl from the command line, and in a VS Code terminal, since the process is killed when VS Code is closed.

zeitstein 2025-03-14T10:03:06.523009Z

Hey, guys. It's on a Mac. It happens every time on this project for me. It is "start a repl and jack-in", with a custom connect sequence (I should test without the custom sequence!). @pez is right about the manual steps. It's starting from the VS Code terminal with npx shadow-cljs -d cider/cider-nrepl:0.52.1 run dev/start-dev! then "Connect to a running REPL server".

DrLjótsson 2025-03-11T19:54:51.367829Z

How does the Calva test runner work? I've done some alter-var-root changes to clojure.test, which I can confirm take effect in the repl, but when I ask Calva to run the tests, my changes don't take effect. Are they run in a separate environment somehow?

DrLjótsson 2025-03-16T21:04:58.956639Z

Thanks! I’ll dig some more into this.

pez 2025-03-14T09:06:46.161989Z

There is a concept of nrepl sessions. They have different dynamic environments. So *ns* and such. But I the test runner runs in the same session anyway, so it couldn’t be that… Maybe ask in #nrepl if someone has an idea how this works.

šŸ‘ 1
wevrem 2025-03-11T22:15:05.773629Z

Does anything exist that lets me search by form structure? For example, say I wanted to find places where (this is a re-frame related example) I had registered a subscription with a signal function. Most of my subscriptions are set up like this:

(rf/reg-sub
  ::my-sub
  (fn [...] ...))
but if I used a signal function it would look like this:
(rf/reg-sub
  ::another-sub
  (fn [...] ...)
  (fn [...] ...))
I would love a way to search for that pattern of forms, something like (rf/reg-sub * (*) (*)). I know I could probably figure out some hairy regular expression that might get me there, but it would really be nice to have the search "know" about forms and let me search using a pattern based on the form structure.

wevrem 2025-03-11T22:51:26.720669Z

Just in case anyone was really worried about me, I did use this pattern and found uses of signal functions,

rf/reg-sub\n ::.*\n \(.*\n \(
which I then marked with a ;; signal-fn comment so I can find them again later. So the regex wasn't all that bad. But still, I think it would be handy to have a form-aware search capability.

šŸ˜‚ 1
pez 2025-03-12T06:36:14.293809Z

We do searches like this in Calva, such as when figuring out the current ns. These searches are not across the codebase, but anyway, they need to be structural and can’t be transformed to a sweet regex like yours there. My brain hurts a little trying to figure out what facility would allow this in user space, but maybe exposing more of Calva structural editor to #joyride would make it possible to create custom searches with a bit of Clojure code in user space...