Fork me on GitHub
#calva
<
2021-01-21
>
thom01:01:18

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!

bringe01:01:04

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.

bringe01:01:52

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

pez06:01:55

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

plexus07:01:55

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

pez07:01:44

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.

pez07:01:25

@UTF99QP7V 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

pez07:01:09

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

plexus07:01:38

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

plexus07:01:01

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

pez07:01:39

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.

pez07:01:36

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.

plexus09:01:13

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

pez09:01:51

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

borkdude11:01:34

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

pez11:01:12

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!

pez07:01:26

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
pez12:01:06

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. 😍

roelof17:01:12

@pez are you also helping on clojureverse ?

pez18:01:37

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

❤️ 3
richiardiandrea18:01:59

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.

richiardiandrea18:01:18

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

richiardiandrea18:01:05

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

richiardiandrea18:01:23

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?

pez19:01:12

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

richiardiandrea20:01:36

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

roelof18:01:18

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

❤️ 1
roelof18:01:29

and it looks very well

calva 1
ghosttoaster20:01:28

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?

pez20:01:02

@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.

ghosttoaster20:01:25

ah then connect to it via port number?

pez21:01:20

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.

pez21:01:40

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.

ghosttoaster21:01:17

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>.

pez21:01:18

Yes, can you post the link to that page?

pez21:01:35

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

ghosttoaster21:01:04

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!

pez21:01:57

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

ghosttoaster21:01:17

its banannas useful

ghosttoaster21:01:40

finally feels like java is moving into the 21st century

ghosttoaster21:01:26

virtualenv for java? Um, yes please!

pez21:01:46

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