Fork me on GitHub
#calva
<
2023-01-24
>
pez12:01:22

New release, dear Calva friends: https://github.com/BetterThanTomorrow/calva/releases/tag/v2.0.326 • Fix: afterCLJReplJackInCodehttps://github.com/BetterThanTomorrow/calva/issues/2025 • Fix: https://github.com/BetterThanTomorrow/calva/issues/2022 Two small, but important, quality fixes. Keep reporting such things, please. 🙏 calva

👍 6
🎉 4
pez13:01:24

Dear Calva friends, please help test an important update to Calva. It is @m401 who has been working on making Calva's clojure-lsp support smarter around monorepos. The main change is that Calva will be able to start multiple clojure-lsp servers to server different projects in the monorepo. For single-project workspaces things will continue to work much as they do today, which is something you are very welcome to confirm by installing this VSIX. Please let us know how you fare! Do you prefer feedback here or on the PR, Julien? • https://output.circle-artifacts.com/output/job/bcc6ebf0-9d5f-428b-8d9a-9a2142a48a9e/artifacts/0/tmp/artifacts/calva-2.0.326-pull-2020-ec782ad5.vsixhttps://github.com/BetterThanTomorrow/calva/pull/2020

julienvincent13:01:54

Feedback on the PR would be preferable - but here is ok too :)

ericdallo14:01:34

Kind of curious why spawn multiple clojure-lsp proccess for the mono-repo, currently clojure-lsp uses 2GB ram per process, if the mono-repo has 6 subprojects would spawn 6 process? There are ways that we recommend to configure the lein or deps project in a way you spawn a single clojure-lsp process in the mono-repo root and it uses the classpath for all subprojects in the same process. clojure-lsp project it's a mono-repo itself for example, and you can just start a single clojure-lsp process on the mono-repo root and everything should work

julienvincent14:01:06

For a mono-repo configured with a root deps.edn or lein project only a single lsp server will be started. If you have a multi-workspace (multiple folders open in vscode) then this adds support for starting lsp servers in each workspace. Additionally / similarly when opening a directory with multiple independent projects (so not a mono-repo necessarily) this adds support for starting lsp servers for each independent project

julienvincent14:01:48

Also, lsp servers will be started reactively to project files being added/opened. So opening a directory containing multiple projects won’t result in multiple lsp servers being started preemptively

pez14:01:40

We should probably clarify in the Calva docs that a deps.edn at the monorepo root is to prefer over spawning several servers.

ericdallo16:01:27

got it, sounds good make that clear on the docs as well, thanks, that sounds like a nice improvement!

seancorfield17:01:01

Ironically, I could have really used this change a year ago -- when our monorepo had the Clojure code in a subfolder -- but because of the pain of dealing with tooling (not just LSP) we ended up lifting the Clojure "project" up into the root of the monorepo so it is all one big "Clojure project" now with a couple of extra folders/files 🙂 The multi-workspace aspect sounds great -- I may well go back to an "open source workspace" with all my OSS projects loaded into it, once this change hits the main branch.

BlueMax19:01:24

Hi, n00b here trying to get Calva to work with Reveal and using leiningen; I have a reveal profile in my project.clj

:reveal {:dependencies [[vlaaad/reveal "1.3.277"]]
            :repl-options {:nrepl-middleware [vlaaad.reveal.nrepl/middleware]}}
but when I jack-in, the reveal window comes up but nothing I evaluate appears there (see screenshot)

pez20:01:19

I don't understand either why it works when you start the REPL with the same command line... If you connect to that nREPL server from Calva, do you get Calva evaluations in the Reveal window?

BlueMax20:01:10

I just tried that and unfortunately no...

pez23:01:32

I'll try this myself and see what I can figure out. But tomorrow. Late here now. I know I have had Reveal working before.

👍 2
BlueMax13:02:33

Hi there. Just wondering if you had a chance to look at this yet or perhaps it was addressed and I missed it. Thanks!

pez13:02:04

Oh, thanks for the reminder. I have completely dropped this ball. Will have a look now.

👍 2
pez14:02:03

Hello again. As this is hard to reproduce for me, I created a mini-project that works when I try it. Maybe we can learn something if you try it too: https://github.com/PEZ/minimal-reveal-leiningen

pez14:02:49

If you don't have specific reasons to use Leiningen, I think that a deps.edn project is probably better to start with. We're having some issues with Leiningen support in Calva that we haven't figured out. (Doesn't affect most projects, it seems, but anyway.) So, here's a mini reveal project using tools-deps: https://github.com/PEZ/minimal-reveal-deps

BlueMax14:02:05

Ok I’ll give it a shot and let you know!

BlueMax16:02:23

Hi there, I tried it out; 1. Without Calva, worked fine 2. With Calva, not working; see screenshot

pez17:02:37

That’s very interesting :thinking_face:. Did you try the tools-deps project?

BlueMax18:02:10

sorry, not sure I understand. Is tools-deps a different repository I should clone and try out?

BlueMax18:02:24

sorry, I didn't realize you put two repos up above... The screenshot above is using tools-deps; The below screenshot is using the first repo (leiningen). same issue

pez20:02:42

This is so very strange. There's absolutely no reason that I can think of why it would differ. Can you try connecting Calva to the REPL started in the terminal? This really should be the same as Jacking in (the command lines are copied from what Calva uses) but since things are this weird already, I obviously don't understand this well enough to say something like ”should be the same”.

BlueMax21:02:06

I tried this with the tool-deps project but no luck. From the terminal, I executed: clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version,"1.0.0"},cider/cider-nrepl {:mvn/version,"0.28.5"}}}' -A:reveal-nrepl-middleware and then in VSCode, attached to a running REPL but all I got was below.

pez09:02:07

I am out of ideas what could be going wrong here. Please file an issue. You can use VS Code for it. (From the Help menu.) That will include information about your machine and versions of things and such.

BlueMax16:02:01

Ok I will do so. Do I file it on VS Code or an extension ? (Incidentally, I tried all of the above on another Mac machine and it worked! so something on my machine presumably)

pez16:02:09

File it on an extension. Then choose Calva.

👍 2
BlueMax19:01:35

If I copy/paste the startup line from Calva into a terminal window,

lein update-in :dependencies conj '[nrepl,"1.0.0"]' -- update-in :plugins conj '[cider/cider-nrepl,"0.28.5"]' -- update-in '[:repl-options,:nrepl-middleware]' conj '["cider.nrepl/cider-middleware"]' -- with-profile +dev,+reveal repl
(minus the :headless option at the end*),* I do get a working Reveal. so not sure why it's not working from within VSCode/Calva.

🧵 2
zimablue20:01:10

does calva's one-open-repl apply to joyride also? so one can't be calva-REPLING joyride to access the calva-api-REPL through to somewhere else?

pez20:01:51

That's correct. Hopefully we will be able to fix this eventually. For now there are a few things you can do. You can use Calva's ranges API with Joyride to give yourself some commands to evaluate things like the current form. Joyride has a command for evaluating the selection, but it can be a bit too spartan at times. You can also start an integrated terminal and connect an nREPL client to Joyride's nREPL server. So you'll have a prompt, plus whatever evaluation commands you hack together using Joyride.

pez20:01:26

CC: @m401. I've been mentioning this in our chats.

zimablue20:01:12

Yes I had just gotten to this workaround, remember I was bothering about the escaping of ranges in command snippets, I was trying to reimplement part of that customreplcommand stuff in joyride using the calva ranges so that I can control the escaping

pez20:01:56

Ah, yes, I remember. 😃

zimablue20:01:58

If I can dynamically bind keys in a joyride startup script o should be able to do almost anything fairly ergonomically

pez20:01:58

You can create functions in startup (activation) scripts and bind shortcuts via the JSON config for that.

pez20:01:36

VS Code does not have API for dynamically binding keys, afaik.

zimablue20:01:44

I was just looking that up

zimablue20:01:56

Microsoft are sick they must be stopped

zimablue20:01:13

If so, but also if not

zimablue20:01:58

closed as won't-address, chews desk in anger

pez20:01:40

Yeah, it's frustrating.

skylize01:01:36

Doesn't Code reload keybindings automatically when keybindings.json is saved? I expect you should be able to "dynamically" create keybindings by writing them to the file. 💡

metal 4
zimablue15:01:48

yes I wrote half the code to do this last night, it's ugly though, that's not even a JSON file, it autogenerates with comments

zimablue15:01:23

I haven't tested/read yet whether it watches that file on disk or needs to be notified that it's changed

pez15:01:06

It watches it.

pez15:01:03

You can add keys to the entries, to keep meta-data you might need. (You probably know this, but anyway 😄 )

zimablue16:01:58

I didn't know that actually thanks

zimablue16:01:24

I think I want all the info in the init code though and great the keybindings as a random serialisation with no brains

zimablue16:01:45

Kind of excited about this, who wants to help me reimplement helm?

pez20:01:26

What's helm?

pez20:01:49

I think it is some Emacs thing, but even that could be wrong. 😃

zimablue20:01:13

Search/navigation module for Emacs, spacemacs integrates is heavily

zimablue20:01:05

Key chord as a tree with a buffer displaying your available options as you navigate it

zimablue20:01:56

Caveat I think, it's been a while

pez20:01:43

Ah, yes. Something like that was what I was remembering vaguely.