Fork me on GitHub
#calva
<
2021-09-15
>
pez08:09:49

I’m he Calva space in Gather, if anyone would like to have a chat, get help with something, ask something, whatever. Details in the channel topic.

Ramon Rios14:09:22

Did you folks ran into issues while jack-in? the issue itself it´s that nrepl is conflicting with my project. Looks like some of the dependencies i´m using uses nrepl

pez15:09:30

So @ramonp.rios visited the support room in Gather. 😃 I could only rubber duck, but at least we’re unblocked.

Ramon Rios15:09:56

That´s a really cool experience

pez15:09:37

The particular problem was one I haven’t seen before. Something in the project (not directly) brought in nrepl/nrepl "0.8.3" (the same as Calva Jack-in injects by default), it was brought in with an exclusions . Don’t know if that had anything to do with it, but anyway, things didn’t work until Ramon edited that injection away from the command. Then he could connect. … Does anyone know if there is a command for checking which dependency brings in a particular dependency?

bringe15:09:07

clj -Stree might be helpful if it’s a deps.edn project.

bringe15:09:27

The output would need to be searched for the dep in question, though.

pez16:09:49

The dep in question here is nrepl/nrepl. And it is a Leiningen project, so maybe clj won’t do it?

pez16:09:19

@ramonp.rios and I tried with lein deps but we couldn’t really make sense of the output.

bringe20:09:40

Did you try lein deps :tree?

bringe16:09:47

Hm. I would expect it to show nrepl somewhere nested under another dependency, which would be the one pulling it in, but I’m not sure what you saw as output.

pez17:09:38

It was a huge output and really hard to see what was nested in what.

pez15:09:28

On another topic. Earlier today @alexander.minolta asked if there is a command that can open a file by pasting the Clojure namespace of it. Which there isn’t, and since Calva supports navigating to files from namespaces I don’t think it is much worth adding it to Calva. However, it sounded to me like there is general enough use for replacing things when pasting in a configurable way. So I created an extension of its own for it. 😃 https://marketplace.visualstudio.com/items?itemName=betterthantomorrow.paste-replaced Demo of what I think solves Alexander’s use case attached.

💥 4
pez15:09:57

I’m especially proud of the icon, which I just made up. 😃 See how the the clipboard is reshaped as it is pasted?

Alexander Kouznetsov19:09:40

Icon is great! Checking it out right away.

Alexander Kouznetsov19:09:16

The main reason I asked about it is to simplify getting from logs, test results and stracktraces to the source code.

Alexander Kouznetsov19:09:19

This is cool, it actually does exactly what’s needed. Is it possible to limit it only to the command pallete input?

pez19:09:19

You should be able to specify that in the when clause of the keyboard shortcut binding. But you can also just not use it in places you don’t want to use it?

Alexander Kouznetsov20:09:20

I was actually thinking about using a standard shortcut for it (cmd-V) in that field.

Alexander Kouznetsov20:09:48

Do you know how to specify it in when?

Alexander Kouznetsov21:09:49

I configured it like this and this is real magic!

metal 2
Alexander Kouznetsov22:09:20

One thing I noticed is that in your example config, dash to underscore replacement should also use global flag "g" . OTOH, while this extension improves the problem by a lot, there is still a problem remaining: when opening a file via command pallete, it is looking for matches using some fuzzy search and rating recently opened files higher than exact matches, so it won’t always bring the exact match on top. This is especially true in cases when you have a test file that matches the namespace almost exactly but has extra “_test” in the name.

Alexander Kouznetsov22:09:53

Thank you again for doing it @pez! I really appreciate you looking and implementing it!

Alexander Kouznetsov22:09:31

I had to change the shortcut back as it was messing around with branch names.

pez05:09:30

Yes, inQuickOpen is not precise enough.

pez17:09:32

So now it has two installs, you and me @alexander.minolta

❤️ 2
Jakub Holý (HolyJak)17:09:09

Hello! When doing jack-in to a deps-based project, is it possible to specify somehow also aliases defined in my ~/.clojure/deps.edn ? They are (fortunately) not listed there. Additionally, can I set options like I can do on the clj command line, e.g. -J-Dtrace ? I guess calva.myCljAliases is the answer?

pez18:09:48

You guessed it about the aliases. There's no way to add arbitrary command line options though. That we could add.

🙏 2
Marc O'Morain20:09:57

@pez I’m back again, trying to add the Test Result view into Calva 😄 I’ve opened a PR to add some type annotations to testRunner.ts on top of which my subsequent changes should be easier to make safely.

pez20:09:15

Welcome back! Have you had a look at Test Explorer and if we should integrate with that? It is great with JS.

Marc O'Morain06:09:58

Yup, I have indeed.

Marc O'Morain06:09:55

Reporting the tests into Test Explorer is pretty straight forward. I’ve built a little prototype where I can run tests through Calva and get the results to display in Test Explorer. The harder part is the part that should be easy 😆 enumerating the tests up-front.

pez06:09:03

Can we do without that at first, maybe? Instruct the user to run all project tests to populate it.

pez06:09:43

Merged the PR. Huge improvement! Thanks! (I wrote that horrible code before converting Calva to TypeScript, but I wouldn’t have written it much better either way because Calva is my first TS experience. 😃 )

Marc O'Morain07:09:12

Yup, I think that will work. At least we can populate it as folks run tests.

Marc O'Morain07:09:21

Clojure is so dynamic that “all tests” doesn’t have a precise meaning.

pez07:09:37

Good point 😃

Marc O'Morain08:09:52

> I wouldn’t have written it much better either way because Calva is my first TS experience. 😃 ) > > At CircleCl I spend all day wrangling with a 10 year old monolith that was the first Clojure project for about 100 people.

Marc O'Morain08:09:40

So I know that feeling.