Fork me on GitHub

@lspector , sure you don't have an error in the file?


If you don’t want the files to be evaluated on save, disable that in settings.


Yes! There was an error in the file (which I was also using to test error output). Now I see that it is indeed re-evaluating... which I don't want. I have found and turned off the "Calva: Eval on Save" setting, but it's still re-evaluating on save, including after quitting/restarting VSCode and the REPL


Very strange. For me it immediately stops evaluating on save when I untick that option… No restart needed.


My file is just:

(ns calvatest.core)

(def c 25)

And the "Calva: Eval on Save" setting is unchecked. Whenever I change the value and save, the new value appears in Calva says.


FYI I'm often working with long-running expressions (hours at 100+% cpu), so it's not great if evaluations happen automatically or on save.


No, that’s what the settings is there for. Never heard of it not working though…


I hide stuff I don’t want to “run” when loading the file inside (comment) forms. Calva has special top-level semantics for those and evaluating forms inside them is really easy.


But why that setting would fail for you, puzzles me.


I've used and like the (comment) approach in some cases, but for using a file and Calva says as a REPL/worksheet you don't want to have to type that for every command (or get re-running of everything if you save).


No, just mentioning. The top-level support for comments is something most people don’t know about.


Is there some other setting or approach you can think of to turning off the auto-eval setting?


Or some way to say "Save, really just save"? I'd rather not run tests or do anything else either, just save.


Does the run-tests-on-save setting work for you.


VS Code does have a “Save w/o formatting” setting, but it will eval on save anyway. I just tested it.


Really, switching that setting off should just stop it from evaluating on save. I wonder what is going on….


Tests (of which I have none) appear to run on save:

Running namespace tests…

No tests found. 😱, ns: 0, vars: 0


There is a setting for that too. Tried it?


I wonder if maybe you have workspace settings overriding your user settings. Or vice versa, I am not sure which has precedence.


what version of calva are you using


I see settings for running tests, but not on save. Where are separate settings? I'm changing things in Code > Preferences > Settings, in Code 1.32.3 under MacOS 10.14.3.


So if you search for calva save in settings?


huh now i do see that setting... was trying to search differently. switched...


exciting news!


If I also turn off "Calva: Test on Save" then it stops either evaluating or running tests on save


So now saving just saves, which is what I want. FWIW I think that'd be a nice default 🙂


Thanks so much!


Ah, now I know what was going on.


I’ll change the defaults for those on next major release, @lspector. I agree they can cause trouble. I’ll think of some way for Calva to try teach people new to Clojure about the need for evaluating things before other things start working.


Awesome -- thanks!


FYI I'm often teaching people entirely new to programming (not just clojure), and would be more than happy to give feedback on additions/docs on this. FWIW I'm bringing my own gaps and confusions to the table too, not from being new to Clojure but from coding in research/academic/science/art settings mostly rather than traditional software development


That would be tremendously helpful, @lspector. We are preparing a new release with dependency injection and a much better REPL window experience. A rewrite on much of the README and Getting Started stuff will be needed and input on how those work for newcomers would help a lot.

👍 4

Will the REPL window be different both from Calva says and from the terminal REPL? It'd be great to have one place that's perfect, but the proliferation is already a bit confusing


And maybe I shouldn't get too deep in documenting how to work with Calva says...


I think there will be a “Calva eval results” where those will go. In the first version that will probably still be a plain output channel, but it will later move to a window supporting pretty printing and syntax highlighting.


Will there be a single place where evaluated results and printed output and error messages go? My need is for one such place. It should be plain text that can be copied/pasted. Ideally it should include nothing extraneous like echoed source code or "=>" markers. It's good if it scrolls so that the most recent stuff shows. Pretty printing is nice if it's optional (one can just call a standard function for this, right?) but not otherwise. More or less the same for syntax highlighting (usually it would be a minus)


Pretty much like that. But syntax highlighted, of course.


Syntax highlighting on values, printed results, and error messages? Most of that usually won't be code.


On results.


Printed output and errors do not get syntax highlight.


Would it be possible to turn off syntax highlighting?


No. I try to keep the settings to a minimum. Evaluated results are always clojure data, so it makes sense to syntax highlight it.


Hmmm I'd hope that default behavior would be the simplest, plain text output...


Or if not default, that it'd be easy to get this. I guess if I cut and paste into a plain text editor, though, I could recover the plain text?


It'll be plain text. So, yes.


That's good. Probably not a big deal either way then. But out of curiosity, if the output contains the list (map foo bar) is map going to be highlighted as a function?


Also, this will all not be in "Calva says"? That means there'll be 3 sets of commands for evaluating things, with some sending things to the terminal REPL, some sending things to "Calva says" and also showing them inline in the editor, and the third sending things to the new REPL window?


To be clear, my interest is (maybe only) in having one, which shows return values, printed values, and error messages, in as unadulterated a way as possible.


Not exactly like that. This will be a window replacing the Calva says.


Ah -- good to be back down to 2 🙂


You have the option to use just one. 😃


In essence the new window will be like the REPL window, just without the input prompt. So it will be just output.


FYI was just looking at a student's machine, running Windows (I use Mac), and it looked like his Calva commands were slightly different? It wasn't clear to me which would go to the terminal REPL vs. "Calva says"


All commands sending stuff to the terminal are named like that. And often with the same default shortcuts as their inline counterparts, only with alt-key added to the final chord.


So, to evaluate the top level command inline it is ctrl+alt+v space and to send the current top level command to the terminal it is ctrl+at+v alt+space.


He might have changed the shortcuts, but I don’t think he can alter the name of the commands.


I'm more likely to pull up the command palette and choose the command thatn to remember the chord, which is probably true of my students too. It might be nice if the actual command names could be more about the terminal vs. other option, I guess


I might have been confused about his list of commands because it reorders based on usage, so mine is showing up in different order


I don’t know how they could be more about that than they are.


Yeah, that could be why. Type calva term in the palette and all terminal commands will be filtered out.


Using the keyboard shortcuts is entirely voluntary. I have just tried to make it easy to know the terminal shortcut if you know the inline one.


I guess anything that doesn't explicitly say "in terminal REPL" is implicitly "in Calva says (or REPL window that replaces it) and maybe inline"... Is that right?


Yeah, that’s right. The terminal was added later so it got special names. 😃


The inline ones are mostly named just Evaluate.


Good to know! FWIW that won't be so obvious to newcomers


Maybe nice if there was just one option (the one I like 🙂), or if the naming was more explicit both ways


I don’t really see them as equivalent. The Terminal commands are there to make it easy to experiment with them at the prompt. I’ll have a think about the naming.


I think of them as two superficially different ways to accomplish the same thing: try some code and see what it does


So from my perspective it's a bit confusing that there's more than one, that they behave differently, and that neither quite shows me everything in the most simple way


A little extra confusing when it's not super clear which commands and/or setup steps are required for one vs. the other.


Whether code to be evaluated is typed/pasted at a prompt or in an editor seems like a minor difference, but in any case I'm interested in having all results and printed outputs and error messages go to the same plain text (and select/copyable) place, unadulterated (so without any annotations, and if someone wants it pretty-printed they could use clojure.pprint/pprint)


I mostly work in the files. But others like to do their experiments more often at the prompt. So Calva supports both.


I see supporting both is good! But clarity between them is good too, and getting all and only results/printed-stuff/errors to show up in a plain text place is key for me.


I hear you about the getting all results and stuff in one file. It will be syntax highlighted, that’s the only thing you won’t get rid of. 😃


I'll live 🙂


I want to share a concrete example. With this code in a file:

(ns calvatest.core)

(defn foo [x]
  (println x))

(foo 13)

(foo 17)
If evaluate all of the expressions individually with "Evaluate selection or current form" then this ends up in "Calva says":
=> nil
=> #'calvatest.core/foo
out: 13
=> nil
out: 17
=> nil
In addition, the return values (only, without the printed values) appear inline in the editor. On the other hand, "Evaluate current file" puts only the following in "Calva says":
=> nil
On the third hand, selecting all and using the "Evaluate selection or current form" puts the following in "Calva says":
out: 13

=> nil
Plus, the last "=> nil" appears inline in the editor. This last one is particularly puzzling for a couple of reasons. But I want to jump to what I hope to be able to get, via one method or another. What I'd like to see is either:
That is, I want to see all explicitly printed text (unadulterated), and either all return values or just the last one. I've seen different approaches to the question of printing all or only the last value, and I think either could be fine. But I wouldn't want anything else in there (like => or out:).


(Plus there should be error messages if one introduces errors.)


The first one will be a bit like what will happen in the case of selecting all and evaluating it. The loading of a file is an nREPL op that behaves like it behaves so it will just print the last evaluated result (which I think is awesome for that op to do).


FYI. This will take a while before it gets fixed though. We have a demanding backlog to wade through first.