Fork me on GitHub
#calva
<
2022-04-12
>
pez08:04:04

Dear Calva-friends. Here's a combo of two Slack tips and an ask for help: • Tips: In Slack Preferences -> Notifications, there's a My keywords entry where you can put words that you want to know when they are uttered somewhere in the slack. E.g, You can put calva-friends and calva friends in there and get this channel badged when I use it to address the channel. Or your name/handle, or whatever. A possible follow-up is to mute channels you are interested in, but that are too active for what your attention span allows. You'll know when someone utters the keywords you are interested in. • Ask: Put calva in My keywords, if you want to help us help users having questions about/troubles with Calva. Happy slacking and thanks in advance! 🙏 calva

👍 3
ericdallo11:04:04

I love that slack feature, it's the only way I know wherever one mention LSP in any channel 😅 Almost sure borkdude does the same for clj-kondo and bb 😛

pez12:04:30

Would borkdude use such easy means? 😃

😆 1
pez12:04:30

It's funny how when all three, Calva, clj-kondo, and clojure-lsp are mentioned, we all three pop in: ”You summoned us?”

😂 3
maxt10:04:20

Hi! When I send long structures to the repl, are they supposed to be warpped? I.e. when I do (range 100) should I in the calva-repl window excpect one line or 100? I was excepting it to wrap, i.e. to be 100 lines, but I'm getting it on one line. The same thing with maps. I get all the keys on the same line and have to scroll horizontally to see them. Toggling pprint doesn't seem to change it. I think I remember it used to wrap, but I might be wrong. I havn't dug into it, just wanted to ask what I should expect before I do.

pez11:04:32

We've recently changed some around the pretty print defaults. Maybe that causes the new behaviour for you. See if you have any settings configured. And see if this page helps any to get it behave like you want: https://calva.io/pprint/ Basically, Calva just dispatches this work to the pretty print engine you choose, and they all behave a bit differently with the options.

maxt13:04:02

Thank you, I'll play around with it

maxt16:04:41

I experimented a littlebit. I (tried to) start a fresh vscode without settings by pointing it to an empty directory with

code --user-settings-dir vscode --sync off .
Then I ran a few commands using the babashka repl, and none of them seems to wrap.

maxt16:04:59

When I use clojure.pprint directly, it does wrap, but at column 1024

pez16:04:40

Ah, babashka... So Calva should do some checks, that it doesn't do on the nrepl server. I don't think babashka's nrepl server implements the pretty printing op.

maxt16:04:06

aha, interesting, I didn't realise there was a diffreence. I'll try with normal clojure

pez16:04:16

You should be able to use the calva pretty print engine. Just know that if you produce infinite results, then maxLength won't save you, as it does with server side printers.

pez16:04:52

Calva assumes cider-nrepl which isn't true for babashka.

1
maxt16:04:23

Using the calva engine gives me the desired results, both for regular clojure and babashka

maxt16:04:38

It also turns out that even with --user-settings-dir, vscode still picked up some old settings. Do you have good way to create clean repro-cases with vscode?

pez16:04:00

The calva engine operates client side and does not rely on any nrepl op being in place for it. It will however, hang if you evaluate an infinite sequence. Something that can be avoided by setting maxLength with the server side options. You can interrupt the evaluation if that happens.

pez16:04:27

For settings I just make sure that I'm using the settings I want to test. Commenting out any settings I use outside testing. My settings file are a mess, actually.

1
maxt16:04:54

Thank you for your help!

🙏 1
pinkfrog12:04:01

How do you quick comment a dict pair. For example, given

{:a :b
 :c :d}
Quickly comment out :c :d.

wevrem12:04:01

#_#_

4
😆 1
pavlosmelissinos13:04:05

in this particular case a line comment (`;` or ;;) should also work. I think paredit-enabled editors are generally able to detect what you mean and move the closing curly brace to a new line automatically. edit: oops, sorry, I didn't realize we're in #calva . Not sure if that works as I described

pinkfrog13:04:21

right. Calva has parinfer mode to get the closing parens right.

😅 1
pinkfrog13:04:10

> paredit-enabled I am not sure the normal structure-editing provided by paredit has such capability?

pavlosmelissinos14:04:22

It does seem that Calva doesn't work like that 🙂 I'm pretty sure that's how paredit-mode works out of the box on emacs, so it's generally what I've come to expect when I use paredit. I thought Calva and Cursive also did it like that but I was obviously wrong about Calva and I haven't used Cursive in years so my memory must be failing me. #_#_ is perfectly fine 🙂

rayat16:04:31

God the more i learn about parinfer the more I want it

manas_marthi16:04:29

Can I configure calva to try to auto reconnect to a repl, if the connection drops intermittently

1
pez16:04:56

There is no such option. But generally Calva tries to reconnect in such situations I think...

manas_marthi17:04:55

When I use Generic repl connection from a non project folder, it is closing connection.

manas_marthi18:04:11

Do I need cider or Cider.nrepl Middleware as deps ?

pez19:04:47

Not to keep the connection. That sounds like something is wron. But generally Calva assumes cider-nrepl to function fully.

manas_marthi21:04:15

The correct option might be to look for .nrepl.edn file

manas_marthi16:04:17

I am trying to add nrepl to spring boot. And connect to it from calva. I added context listener in spring boot that stop and start nrepl everytime spring boot reloads the context after compilation.. I am losing repl connection in vscode and am forced to reconnect after every compilation

🧵 3
manas_marthi16:04:47

I am using Generic repl as my code is neither lein nor deps. I am using maven-clojure-plugin to add clojure code to maven spring project

🧵 3
manas_marthi17:04:06

Calva doesn't recognise the .nrepl-port file I placed in the project root. I hard coded the port to 22222. Is it because it first looks for project.clj or deps.edn folder?

pez19:04:20

I think that with Generic it doesn't look for the port file. Maybe it should...

Max19:04:30

Did Calva used to revert to using VSCode’s default bindings for alt+left and alt+right while inside a string? That’s something I seem to remember used to be true. In any case it doesn’t appear to be true now, alt+left/right always jumps to the beginning/end of the entire string

pez20:04:15

I don't think we have ever made something special inside strings. It should basically move by word inside strings and jump over strings if outside them. Sounds weird that it should move to beginning/end inside strings. Can you provide an example?

Max21:04:45

Interesting, you’re right. I’m noticing that it behaves the way I’d expect with a string like “foo bar”, but not with a string like “foo/bar”. Normally alt+right/left stops at word separators (as defined by the editor.wordSeparators setting), but inside strings it seems like Calva only stops at spaces.

pez21:04:20

Yes, it is still moving by sexpressions inside strings. The wordSeparators setting is not involved. If there is a when clause context for within string you might get away with adding that (negated) to the shortcut binding.

Max00:04:50

Thanks for the tip, this ended up working:

{
    "key": "alt+right",
    "command": "cursorWordEndRight",
    "when": "calva:cursorInString && calva:keybindingsEnabled && editorTextFocus && editorLangId == 'clojure' && paredit:keyMap =~ /original|strict/"
},
{
    "key": "alt+left",
    "command": "cursorWordLeft",
    "when": "calva:cursorInString && calva:keybindingsEnabled && editorTextFocus && editorLangId == 'clojure' && paredit:keyMap =~ /original|strict/"
},
Would you be interested in a PR that made that the default behavior? It seems similar enough to what you’d want inside comments, and Calva makes an exception for that

bringe23:04:24

Not sure if this convo has been moved to GH, but pinging @U0ETXRFEW here just in case.

🙏 1
pez04:04:51

Oh, I’ve forgotten to reply. Thanks, @U9A1RLFNV ! I’m undecided about making this the Calva default. Maybe users who want this rather should either do it themselves, or consider this (from the docs): > You can relax how Paredit's shortcuts replace VS Code built in shortcuts a bit by setting calva.paredit.hijackVSCodeDefaults to false.

pez04:04:01

There is one more thing complicating this. We are removing these contexts in the multi cursor branch. Out at least that's how it looks now. @U037TPXKBGS has been looking at it some and it gets complicated to keep them when cursors can be in different contexts…

rayat06:04:32

Yes, I agree both that default behavior might vary across users. However, I also agree that making it possible for users to configure is tricky with multi cursors! Any ideas would be appreciated heavily! A dirty option might be to keep the contexts but they only apply to the primary cursor. 🤷:skin-tone-4:

Max13:04:10

My first thought is that Calva should probably do the same thing VSCode does in these situations, so I took a look through the default VSCode contexts. Unfortunately none of them have the same problem we’re talking about here, so no luck there. My next thought is that as a user, I’d expect each cursor to behave independently, so cursors inside strings and cursors outside strings would be sent different commands. I’m not sure that’s possible though. My final thought is that I notice that the default VSCode contexts seem to deal with multiple selection by providing multiple contexts: see editorHasSelection/editorHasMultipleSelections, etc. One solution would be to provide multiple contexts: anyCursorInString, allCursorsInString, maybe also oneCursorInString?

pez20:04:51

This is the same person and question as here. https://clojurians.slack.com/archives/C053AK3F9/p1649737136121179 Just noting.

pez20:04:06

I haven't used Figwheel Main in a while. I think I should do that to see that things still work from a Calva perspective.

pez21:04:09

OK. Now tested both the tools-deps and lein templates. Things work. Now will try to formulate some kind of help there...

manas_marthi03:04:49

👍:skin-tone-4: