Fork me on GitHub
#calva
<
2023-06-01
>
cmdrdats07:06:47

in the REPL, is there a way to automatically require the correct namespace on autocomplete? example (json/read-value within the source files knows to require [jsonista.core :as jsonista] - but if I do the same in the repl, it just stares at me rather dumbly - I need to use fully qualified names

pez07:06:48

You mean the REPL prompt, right? clojure-lsp (which provides the auto-require) is not active there, because reasons. Generally the advice is to not use the REPL prompt, and instead use comment forms in the source files (a.k.a. Rich Comments), and/or “fiddle” files in a dev source path.

cmdrdats08:06:40

ah, yes - REPL prompt, sorry

cmdrdats08:06:56

ah, ok - makes sense

pez08:06:24

I enjoyed this episode of #clojuredesign-podcast a lot (well, I enjoyed all their episodes, but this one is on the fiddle file subject) https://clojuredesign.club/episode/014-fiddle-with-the-repl/

cmdrdats08:06:47

ye - a good habit to use that instead actually..

seancorfield16:06:02

My rule of thumb: never* type directly into the REPL -- always use comment in a source file and eval from there. Stu Halloway has made this point in a couple of his presentations -- and you'll hear that from a lot of long-time Clojurians 🙂

👍 2
seancorfield16:06:09

*never: except for absolutely one-off, throwaway expressions perhaps... ...I may type a calculation directly into the REPL instead of reaching for a calculator, for example 🙂

isak20:06:05

Finally got my keybindings ported from Cursive to Calva. These simple and easy to remember bindings have been pretty useful for me over the years - it is basically just code movement and light manipulation using modifiers + WASD keys, like in a FPS game. Posting it here in case it is useful for anyone else. https://gist.github.com/isaksky/94128cda6297e560dbe75650611993c1

thumbsup_all 2
🙏 2
cursive 4
pez20:06:23

Thanks! A PR is welcome to make http://calva.io point to that gist somehow. There’s a page for Customizing Calva where it might fit.

isak20:06:58

Cool, will do

❤️ 2
seancorfield00:06:41

I hadn't realized how much the previous behavior was until you "fixed" it! Thank you! gratitude I have a custom REPL snippet bound to (def $selection) so being able to just shift+alt+right a few times and the ctrl+space d is sooo much more convenient for me!

pez06:06:32

I think you might be using custom shortcuts there, @U04V70XH6, not quite following what’s going on. 😃

seancorfield06:06:59

shift+alt+right is Calva Paredit Expand Selection for me -- is that not the default?

seancorfield06:06:50

ctrl+space d is my REPL snippet to (def $selection)

seancorfield06:06:31

Previously, selecting the symbol and the expression in a let was more work. So I'm happy.

pez06:06:46

Ah, on mac the general grow selection is bound to ctrl+w by default. shift+alt+right expands it a sexpression at a time forwards. But I think my real problem was that I thought you were referring to the new $selection-closing-bracket somehow. 😃

seancorfield06:06:37

Ah, got it. ctrl+w is close window for me (Windows).

pez07:06:58

Which is why we had to change that default for windows. 😃

pez07:06:01

Btw, (def $current-pair) might be less key presses for you.

pez07:06:38

Here’s how the new $selection-closing-brackets can be used to create a command similar to Evaluate Selection, Closing Brackets, but that will instead tap it. (Maybe to #C0185BFLLSE.)

seancorfield15:06:30

If I have (let [a (inc| b)] ...) with the cursor after inc like that -- what is $current-pair?

pez15:06:53

Current pair would be a (inc b) from this (let [a |(inc b)] …), and (I think) also from this (let [a |(inc b)|] …)

pez15:06:25

And from what you had there I think $current-pair is undefined.

seancorfield15:06:59

Hmm, good to know. I think I'll stick with $selection since I mostly start with the cursor embedded in a form and the visual highlighting of the selection is an easier guide to what will get def'd than just trying to move the cursor "up" to the outside of a form.

pez16:06:12

Yeah, makes sense. Especially now that it is easier to select a pair.

escherize00:06:45

As an emacs user who’s curious, this was one of the non negotiable things I wouldn’t switch without. Good job

pez07:06:38

Here’s how the new $selection-closing-brackets can be used to create a command similar to Evaluate Selection, Closing Brackets, but that will instead tap it. (Maybe to #C0185BFLLSE.)