Fork me on GitHub

How can I evaluate (bar "xxx") only given the top level form

(foo (bar "xxx"))


The cursor is within xxx


There is no single command for that. The closest you get is Evaluate surrounding form, default shortcut ctrl+shift+enter. You'll have to go up one form first, ctrl+up (or go forward up ctrl+alt+down), Then Cursor Undo (on mac cmd+u. Putting it together: ctrl+up, ctrl+shift+enter, cmd+u. There are some extensions that let you string commands and bind them to a shortcut, if this is too much finger exercise. 😃 Could be less of an exercise to go up two levels and evaluate current form: ctrl+up, ctrl+up, ctrl+enter, cmd+u, cmd+u

😂 1

I don’t quite get why evaluate surrounding form concerns about the “” string pair. It would be more natural to directly evaluate on the () enclosing form.


It's an effect of that Calva treats strings as list.


Should it continue to do so for eval purposes? Is it possible to decouple the definition of list that Paredit uses from that which is used by eval operations?

👍 1

So far I've been keeping it consistent on purpose. If a user who wants to check what would be evaluated by Evaluate Current Form can use Expand Selection (or Select Current form, depending) to investigate this, w/o actually evaluating anything. Similarly with Evaluate Surrounding Form (with Expand Selection x 2). I see it as a contract/promise. I made a short video about this recently:


Would users find it particularly confusing or contract violating when faced with the exceptional case of evaluation where there is a single "semantically fitting" discrepancy with other "Current Form" operations? I think it wouldn't be unreasonable to internalize that "Ah, because one never evaluates strings, when inside one, Eval Current Form behaves somewhat differently from otherwise, and evals the nearest evaluate-able form, and I understand this distinction and hopefully benefit from it"


Though I'd like to hear from others to get a pulse on what users actually think


I think it adds unnecessary complexity. Both for the user and for us. I'd probably not merge a PR adding this.


Hello! I am extremely new to Clojure and Calva, and I am trying to get the REPL up and running. The REPL with Leinengen is running, however I am not seeing the automatic results on my source file. I have attached a picture of what I expect to show, however it shows nothing. I can call it in the REPL window just fine though. I am on an M1 MacBook Pro, if that helps. . . Although, I am sure this is user error somehow

Cora (she/her)17:04:24

have you done the Getting Started REPL yet?

Cora (she/her)17:04:18

that should get you started and teach you the key chords needed to get eval results inline like you'd like


Starting the "Getting Started REPL" produces the following: java -jar '/Users/makeitekim/.vscode/extensions/betterthantomorrow.calva-2.0.265/deps.clj.jar' -Sdeps '{:deps {nrepl/nrepl {:mvn/version,"0.9.0"},cider/cider-nrepl {:mvn/version,"0.27.4"}}}' -M -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]" Error building classpath. Expected edn map in: /private/var/folders/hl/OMITTED/T/betterthantomorrow.calva/kcbay8/deps.edn Jack-in process exited. Status: 1 I am reading through the guide, but it seems to indicate if you have a build tool (I use Lein), Java, VSCode, and Calva extension, it should just work. However, I may be reading over something crucial


I'll have a look at what's going wrong in the Getting Started REPL.


Getting Started still doesn't work. However, I am able to get "=> output" working now. My Option Key was bound to my window manager, and thus auto-interpretation of functions wasn't able to be called


I for some reason thought that it would auto-evaluate a function just by clicking on the function, didn't know I needed to run a keyboard command each time


To the original expectation. Can you describe the steps you take before the expected results?


Sure, For using the getting started REPL 1. cmd+shift+p > "Calva: Fire Up the Getting Started REPL" 2. Create New Temp Directory 3. "Starting Jack-In terminal" 4. Error occurs due to empty end map in deps.edn file


If this helps, when it creates the Temp directory, the deps.edn file created is empty. Shown here with a cat command on the file.


Thanks. However, I meant the original problem. The one you first posted about


Ahh, yeah they are basically the same 1. lien new app some-app-name 2. Open CLJ project in VS Code 3. Open core.clj 4. cmd-shift-p 5. > Clava: Start a Project REPL... 6. Leinengen 7. :uberjar 8. jack-in done 9. have to use Alt-Enter to evaluate current line


I think my only issue with the project repl was that I didn't understand I had to press Alt Enter every time (option enter on Mac)


Ah, thanks for clarifying that. Yes, you need evaluate things by command. See this page for an intro:

💜 2
Cora (she/her)19:04:46

thanks for hopping in, Peter! 😄

❤️ 1

Very strange with the Getting Started REPL....


Are the other files also empty, @U03BL70M5A4?

Cora (she/her)19:04:43

also is this all running locally on your native OS or is it in WSL or a remote machine or similar?


@U03BL70M5A4: Don't select uberjar at step 7 there. Selecting nothing is probably best.


The deps.edn file should contain

{:paths ["."]}
Really strange that it's empty.


The only Empty file is the deps.edn in the temp folder of Getting Started


all 3 Clojure files have code in them


Maybe it was a fluke. What if you try the command again, choosing to create new files?


I have done that a few times, same result


If I manually sudo edit the file through vim, I am able to get the REPL running.


So, for the time being, now that I know what is supposed to be in the deps.edn file, I can manually bypass the error.

Cora (she/her)19:04:41

oh weird, you needed sudo


Oh I just assumed since it was outside my home directory


I am relatively new to macOS, I come from archlinux

Cora (she/her)19:04:25

in theory you shouldn't need to do that... hmmm


It was a misconfiguration, @U03BL70M5A4. Try the command again now.


Holy moly, it worked


Thanks for letting us know! It must have been broken for some days...


I should have said this, but I wasn't able to get it working on archlinux either, I really just assumed I was doing something wrong, but that makes sense


but now it works


Awesome. I can see how you thought it was a user error. Very hard to know what to expect when you are new to something. Please don't hesitate to fire questions here if you wonder things. I'm always interested in feedback on those guides.


Thank you so much! will do

🙏 1
calva 1