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`.
thom 2021-01-21T01:07:18.217300Z

Is there any way to control the format of line comments in Calva? Weirdly it seems to be specified as double semicolon here: https://github.com/BetterThanTomorrow/calva/blob/947a9fa7614b7b25bf9c2684d3bd5b5c137fc61e/src/calva-fmt/src/extension.ts#L24 but in reality my VSCode just inserts a single semicolon. I poked around the source a bit more wondering if it would be possible to introduce this as a config item but struggled to find my bearings. I also wondered if anyone had any pointers on where to look in the source code if I wanted to recreate paredit style bracket-aware commenting, which shifts closing brackets to the next line when commenting a line. Sorry for the very basic questions, I'm just keen to recreate some Emacs functionality my brain is now hardwired to expect!

ericdallo 2021-01-21T01:27:59.000200Z

Check here: https://clojurians.slack.com/archives/CBE668G4R/p1611162790196800

bringe 2021-01-21T01:28:04.000500Z

I'm glad you've reported this! We were discussing this earlier today. See this issue: https://github.com/BetterThanTomorrow/calva/issues/971. Please comment your system details so we can track down the cause.

bringe 2021-01-21T01:28:52.000900Z

(Seems to only be happening on certain systems, but not sure of the specifics)

ericdallo 2021-01-21T01:31:44.001100Z

Already using with clojure-lsp , It's really a killer feature IMO

pez 2021-01-21T06:29:55.002600Z

It also seems to have started to happen recently. I suspect an upstream bug.

plexus 2021-01-21T07:00:55.002800Z

yes, it seems to be an upstream thing. Trying to find the relevant commit(s)

plexus 2021-01-21T07:03:22.003100Z

seems this was removed from the main repo, it now lives here: https://github.com/microsoft/vscode-clojure/blob/main/language-configuration.json

plexus 2021-01-21T07:07:09.003400Z

let's see how this goes https://github.com/microsoft/vscode-clojure/pull/1

plexus 2021-01-21T07:09:38.004200Z

Does anyone know if VS Code requires something like signing a contributors agreement?

plexus 2021-01-21T09:17:13.008200Z

they merged! that went much faster and with much less friction than I expected

pez 2021-01-21T09:30:51.008400Z

There’s a reason why they have so many contributors to vscode. 😃

borkdude 2021-01-21T11:03:34.008900Z

Oh I didn't know VSCode has their own mode for Clojure, I thought this was part of Calva :)

pez 2021-01-21T11:54:12.009100Z

Well, if you have Calva installed it all should come from Calva. I don’t think there is anything we don’t override. Or, well, we used to override. I really hope the VS Code team fixes this mess quickly!

pez 2021-01-21T07:14:44.004300Z

Let’s. However, as I see it, the bug isn’t that the default extension applies the wrong comment configuration. It is that it overrides configurations from extensions that the user installs. The comment config is the only symptom we have discovered so far, but I think we are up for discovering more unpleasantnesses.

plexus 2021-01-21T07:15:01.004500Z

I did google it 🙂 their "how to contribute" page doesn't seem to mention it, which is somewhat surprising for open source by BigCorp https://github.com/microsoft/vscode/wiki/How-to-Contribute

Eric Uitbeijerse 2021-01-21T07:25:34.004700Z

Would be nice if it does not require a file save, that would save some time. I'll have another look at it later on and report back.

👍 1
pez 2021-01-21T07:30:39.004900Z

I don’t think they do. I almost got a PR merged some year ago. The reason it didn’t happen was that the team had fixed the same issue before they saw my PR. Never a mention of any contributors agreement.

pez 2021-01-21T07:33:36.005100Z

I’ve also updated the syntax grammar (via the Atom repo). Even if it took them half a year to look at my PR, it was merged without me signing anything. And this was after MS had bought Github.

pez 2021-01-21T07:53:26.007300Z

Dear Calva friends: I’ve just filed a bug report issue on VS Code about this comment issue. https://github.com/microsoft/vscode/issues/114684 Please help with making it more visible to the VS Code team by voting on it with the “Thumb up” reaction.

✅ 3
pez 2021-01-21T07:58:25.007500Z

@thom704 a PR with that behaviour would be highly welcome. I’ve been wanting to add it for very long. Best way to implement it is probably by creating a command and default keybind it to ;. Like the strict mode backspace is implemented: https://github.com/BetterThanTomorrow/calva/blob/published/src/paredit/extension.ts#L253

pez 2021-01-21T07:59:09.007800Z

I’m short on time right now, but will be super happy to guide you with this.

pez 2021-01-21T12:19:06.009300Z

So if some of you have some time (I won’t) it would be nice if some Calva people joined this and helped @andyfry01 use Calva in an idiomatic way. I’d like for this 12 startups project to become a success story for Andy as well as for Clojure and Calva. 😍

roelof 2021-01-21T17:57:12.011600Z

@pez are you also helping on clojureverse ?

pez 2021-01-21T18:15:37.012800Z

Helping how? Calva support? I do that wherever I see someone reach out. 😍

❤️ 3
richiardiandrea 2021-01-21T18:32:59.013400Z

Hi @pez and others, have you ever seen this error when jacking-in?

clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version "0.8.3"} cider/cider-nrepl {:mvn/version "0.25.6"}}}' -A:dev:test -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]"
WARNING: When invoking clojure.main, use -M
Execution error (SocketException) at java.net.PlainSocketImpl/socketBind (PlainSocketImpl.java:-2).
Protocol family unavailable
It shows up in the terminal.

richiardiandrea 2021-01-21T18:38:18.013700Z

Ok I think I see what's going on - my app embed an nRepl server already so I don't need to launch it again via nrepl.cmdline

richiardiandrea 2021-01-21T18:50:05.013900Z

Actually no, probably I am running into something similar to this: https://github.com/nrepl/nrepl/issues/20

richiardiandrea 2021-01-21T18:53:23.014200Z

a .nrepl.edn like this one solved

{:bind "localhost"}
Is there a way to pass parameters to nrepl.cmdline while jacking-in by any chance?

roelof 2021-01-21T18:54:18.014900Z

you helped me to find a nice icon to show the user he/she can reach the next page

❤️ 1
roelof 2021-01-21T18:54:29.015200Z

and it looks very well

1
roelof 2021-01-21T18:54:35.015300Z

💯 2
🤘 1
pez 2021-01-21T19:48:12.017500Z

I think so. Hmmm... Maybe by defining a profile that has a main option.

richiardiandrea 2021-01-21T20:04:36.019Z

ah that's a good idea - I will check the docs 😉

ghosttoaster 2021-01-21T20:48:28.021900Z

How do you get Calva to create the repl using a specific jdk? I have some java files that need to be compiled using jdk > 11. But my calva repl refuses to import them because it launches the repl using java 8. Do I have to change my system jdk for Calva to launch my repl using jdk 11?

pez 2021-01-21T20:57:02.024200Z

@cdimara I think you could use the calva.jackInEnv setting for this. That or start code from a terminal where you have the right jdk configured.

ghosttoaster 2021-01-21T20:57:25.024600Z

ah then connect to it via port number?

pez 2021-01-21T21:05:20.030Z

The process that starts your project is what needs to be using the right jdk. Calva can start it, using the Calva: Jack in command, in which case it will need the right environment. Then Calva will also connect to the REPL automatically. Or, you can start your project outside Calva and use Calva: Connect to connect the REPL.

pez 2021-01-21T21:07:40.032600Z

Struggling here with how to describe it, but … in any case once your project is running, Calva is just a client, it is not Calva that imports those java files, it is your app that does that.

ghosttoaster 2021-01-21T21:08:17.033100Z

I think I get it. Also just saw this from the troubleshooting page:

Environment Variables Are Not Readable From REPL

If you've added environment variables in your OS, such as in your ~/.bashrc file (Linux), in order for them to be read in a REPL created by Calva's jackin command, VS Code must be started from a shell where the environment variables are defined. For example, if you can open a bash terminal and run echo $SOME_VAR and see the value there, then open VS Code from that terminal with code <project path>.

pez 2021-01-21T21:09:18.034500Z

Yes, can you post the link to that page?

ghosttoaster 2021-01-21T21:10:00.034900Z

https://calva.io/connect/

pez 2021-01-21T21:10:35.035900Z

Haha, OK. I’m a bit tired, didn’t realize it was from the Calva docs. 😃

ghosttoaster 2021-01-21T21:11:04.036400Z

So I was able to use sdkman to switch up the jdk i'm using (`sdk use java 11.0.9.hs-adpt`) then launch from that shell using code . . That appears to have worked! Thank you!

pez 2021-01-21T21:11:57.037300Z

Awesome. I just love sdkman. A project with a logo like that just have to be super duper. 😃

ghosttoaster 2021-01-21T21:12:17.037600Z

its banannas useful

ghosttoaster 2021-01-21T21:12:40.038Z

finally feels like java is moving into the 21st century

ghosttoaster 2021-01-21T21:13:26.038700Z

virtualenv for java? Um, yes please!

pez 2021-01-21T21:14:46.040Z

Indeed. I wish it was even more like virtualenv. That is the kind of control I want over my project’s environment and dependencies.