Fork me on GitHub
#calva
<
2023-11-16
>
bzrq13:11:19

Is there some way to Copy the *CONNECT* Command Line to Clipboard? Similar to Copy the *JACK-IN* Command Line to Clipboard?

pez15:11:54

Hi! No, there isn’t. Calva just connects, there is no command involved. What is it you want to do where you saw this need?

bzrq15:11:17

Hi @U0ETXRFEW, Calva: I am able to successfully activate a fullstack-workflow to a fullstack https://github.com/boscodsouza82/shadow-flow-storm-basic, when I use Calva-CONNECT. CIDER: I am not able to activate the cljs-workflow for the above mentioned fullstack project, when I use CIDER-CONNECT-CLJ&CLJS. Hence I was wondering about the difference between the 2 connect commands. Please guide.

bzrq15:11:37

Also, I am launching the shadow project like this, npx shadow-cljs watch :dev-test

pez15:11:29

Have you tried launching the project using Calva’s jack-in command?

pez15:11:18

That’s probably not going to solve the issue though. In what way does the cider-connect not work? Do you get any error message somewhere?

bzrq16:11:07

> Have you tried launching the project using Calva’s jack-in command? Yes, it works. Via Jack-In, the project gets launched like this, npx shadow-cljs -d cider/cider-nrepl:0.28.5 watch :dev-test The clear difference between Jack-In and Connect 'launches' is the cider-nrepl injection.

bzrq16:11:01

But both Jack-In and Connect work fine, i.e. both clj and cljs interactive-programming workflows work fine.

bzrq16:11:20

In what way does the cider-connect not work?1. clj repl - works 2. clj buffers - work 3. cljs repl - works 4. cljs buffers - do not work, also show 'cider - not connected' in the emacs-modeline of the cljs buffers.

pez16:11:29

cljs repl works, but not the buffer? Hmmm.

👍 1
bzrq16:11:53

For now, I have solved the emacs-cider problem by using this cider-nrepl injected version of the project launch. i.e. npx shadow-cljs -d cider/cider-nrepl:0.28.5 watch :dev-test But my CIDER setup doesn't work with the plain project launch i.e. npx shadow-cljs watch :dev-test. Calva magically does work. Hence I am left wondering. Not blocked, but wondering.

bzrq17:11:27

Could be an error in my setup. I did try the fresh install of emacs, cider etc. Still the same problem persists. Hence, I put the query here, hoping for the off chance that someone else too might be facing/investigating/solving it. Bright side, I am not completely blocked. 🙂

pez17:11:54

It’s interesting that Calva works without the dependencies injected, but that CIDER doesn’t. Could it be something with which that you need to tell CIDER to use the :dev-test build?

bzrq17:11:48

Yes, that's interesting about Calva.

bzrq17:11:33

I will try to articulate my problem statement better, as my understanding of Calva & Cider logging improves.

bzrq17:11:53

> Could it be something with which that you need to tell CIDER to use the :dev-test build? Doesn't seem like it. Both Calva and Cider ask me for the same inputs for cljs i.e. host, port, target-name. Whether some error happens in Cider after this stage, that I can't answer objectively. I will first need to improve my understanding of Cider logging/error-logging.

bzrq17:11:23

Will post back once I have some more deterministic input. Could take some time though.

🙏 1
bzrq17:11:40

> Could it be something with which that you need to tell CIDER to use the :dev-test build? I am quite new to Cider, so I will look again in this direction that you have suggested.

pez17:11:42

The concept of builds is specific to some ClojureScript build tools, like Figwheel and shadow-cljs. So shadow-cljs in your case. The watch command you have there will start the :dev-test build and its repl. The last step in Calva’s connection process is to figure out which build to connect to and connect to it. I don’t quite recall if we skip to ask if there is only one build in shadow-cljs.edn.

bzrq17:11:13

No, Calva asks, even if there's only 1 build in shadow-cljs.edn

pez17:11:43

It could be that the cljs-repl you have working in CIDER is not the repl for the build, but rather one of shadow-cljs built-in repls.

pez17:11:09

If so it is connected to some cljs app, but not the one you are building. If that makes sense.

pez17:11:29

Does cider ask for the build?

bzrq17:11:44

yes, Cider too asks for the host, port and build.

bzrq17:11:13

> If so it is connected to some cljs app, but not the one you are building. If that makes sense. This could be the case, as I am not very clear about how these various repls work...but it will clear up soon.

pez17:11:18

Very strange. I guess someone in #C0617A8PQ might have ideas of what to try.

pez17:11:44

Or at least where to look for error messages.

👍 1
bzrq17:11:50

okay, I will ask for a suitable cider+shadow fullstack hello-world. I couldn't find any in google.

pez17:11:06

I have one. Just a sec.

1
bzrq17:11:15

Thank you @U0ETXRFEW. I have been through the Agical article a few times. Afaik, these don't have guidance for Cider. Still, I will try the project you shared and report back if Cider behaves any differently. Meanwhile, I also found this today. Hope it helps clarity the right way for Cider+Shadow, https://www.youtube.com/watch?v=Ykztwp2DXjs

pez17:11:44

Awesome. I should link to that video from my article and the shadow-w-backend repo.

bzrq17:11:09

Okay, I will post back here after I go through it.

pez17:11:00

Though. If you can’t get the repls connected with the shadow-w-backend project, I think it’s time to ask for help in #C0617A8PQ. Sounds like something obvious is lacking.

bzrq17:11:44

Also @U0ETXRFEW, Calva (like you) has been a great help for me while getting into Clojure/Script professionally. The main reason I am also focusing on Cider is because Emacs affords a much more streamlined structural-editing workflow (I have found comfort in https://github.com/emacsmirror/symex). I haven't found a good equivalent in the VSCode world, and I am not all fluent in bending VSCode to my will. 🙂

bzrq17:11:18

> Sounds like something obvious is lacking. I just hope it's not an error on my side. Hence, doing the diligence.

pez17:11:04

Makes sense. But I think you have made your diligence. People in #C0617A8PQ will be happy to help you.

pez17:11:16

Symex looks super awesome.

clojure-spin 1
vim 1
lisphug 1
bzrq17:11:12

> People in #C0617A8PQ will be happy to help you. Okay, I will ask there as well. Just let me go through the video once.

bzrq03:11:01

It's a very minor issue. It's fine.

bzrq06:11:16

@U0ETXRFEW, I will again say it now, even though I will repeat this again in the future. Just generally, Calva is a big help!

Christer Nilsson22:11:24

When I press Enter with the cursor being after (filter leap-year? )| the inserted line contains four spaces and two tabs as the image shows. I would like to have nothing or two/three tabs. NO spaces, I'm a tab indenter.

pez22:11:50

Clojure formatting generally does not use tabs, so I think the best option for you is to disable format-on-type for Clojure files. Paste this in the Settings search box to find the setting: <@U0343N85GCV>:editor.formatOnType @lang:clojure formatontype

Christer Nilsson23:11:23

Perfect! My problem, just disappeared.

🙏 1
Christer Nilsson23:11:44

One step closer to a world with no, or at least very few, right parentheses. Left parens and tabs will be enough.

pez23:11:00

I think you’re going to have a better time with Clojure if you follow the Clojure way with things. 😃

Christer Nilsson23:11:40

Hmm, a lot of experience in those words. Parinfer is not available, so what can I do (-:

pez23:11:11

There is a parinfer extension. Unmaintained, though.

Christer Nilsson23:11:09

Tried it. The trouble with parinfer is, it is going in both directions. My starting point is left brackets and tabs for indentation. Right brackets are allowed, but not necessary. This is my modest attempt so far. Standalone, Run on Save. https://github.com/ChristerNilsson/2023/blob/main/042-cli2clj/cli2clj.py

pez23:11:12

Looks fun!

Christer Nilsson23:11:25

This will work even in notepad. Hopefully this can be integrated in a lisp IDE in the future. All that is needed is a small program like this, between reading the file and parsing it. The current balanced version we are using today also works of course. Maybe you know if there is a hook hidden somewhere in clojure, calva or code.

pez23:11:55

Hook for what?

Christer Nilsson23:11:06

Run on Save will be ok, but it is a pity to lose the data.

Christer Nilsson23:11:43

When i do Alt+Enter there is some parsing done. I need to transform the lines with missing right parenteses, by adding the missing right parentheses. They will never be seen in the IDE, not even greyed out like in Parinfer.

pez23:11:54

I see. Calva has some code that does that too, but it’s not really accessible via some API.

Christer Nilsson23:11:47

Actually the clojure parser could do this also.

🎯 1
Christer Nilsson23:11:40

This is like leaving json and going to yaml. Maybe the left parens could also be chucked out, but keeping them seems easier atm.

pez23:11:41

There is a VS Code command called runCommands that you can bind to a keyboard shortcut. You would need to make your thing there run on a command. Not sure what VS Code has for that, but if there is such a command, you can string that command and Calva’s evaluate command together with runCommands.

pez23:11:11

There is also YAMLScript, a Clojure in YAML. #C05HQFMTURF

Christer Nilsson23:11:51

Thanks! Thanks again! I will check this out.

pez23:11:19

If VS Code doesn’t provide a command for executing your program on the file, you can always create an extension that provides the command. Or, thinking about it a bit more, #C03DPCLCV9N can probably be used for it. Then it would maybe make sense to write the whole add-missing-closing-brackets as a Joyride script. And use runCommands for stringing together the Joyride command and Calva’s evaluate command.

Christer Nilsson23:11:14

I guess only top level fragments will be sent to joyride?

Christer Nilsson23:11:07

YAMLScript seemed to be too extreme for my taste. I think going half way is a good compromise. 🙂

😂 1
pez23:11:41

With Joyride you decide what should happen. It gives you full access to the VS Code API in user space.