Fork me on GitHub

What shows up currently in Output > Calva says is pretty close to what I'd want, although there are some oddities. If I select this:

(println :foo)
(println :baz)
and do "Calva: Evaluate current top level form" then this is what is added to Calva says:
out: :foo

=> nil


The oddities are the initial out: , and the extra newline before :baz. If those could be eliminated then this would be right in my book.


@lilactown's compromise seems reasonable to me, but FWIW I'd turn it around, that the most general way to evaluate code, for example presented to new users in any getting-started guide etc. would send it to a text buffer. This is more general because it works for any kinds of values of any size, and the output behaves like text more generally. The inline results that only work for small values, can't be selected, are overlayed on a buffer that they don't really inhabit, and go away on their own when you do other things, strike me as weird things to throw at new users, and I'd think of this as an exotic feature for (some) power users.


@lspector Strange that both get evaluated when you use that command… No, you have a selection and then use that command. I didn’t know that even worked. Will have to look at that.


@pez to be clear, I think this is a feature, not a bug (being able to select and evaluate all of a bunch of expressions). It works with "Run selected text" (but with the weaknesses of that and I understand that's going away)


It’s just that the command for evaluating the current top level form should do that and not something else. There is a command for evaluating the selection already. If that is not working for you, I want to know. 😃

Mark Addleman15:04:03

I'm playing with Calva and having difficulty evaluating individual forms. It appears that the form is always evaluated in the user namespace. Is there a way to get the form evaluated in the file's namespace by default?

Mark Addleman15:04:11

btw, I'm running with the latest beta from this channel


It should do that. But maybe it fails figuring the namespace out.


Too bad, I was going to suggest the latest beta. Which had fixes for just that.

Mark Addleman15:04:09

Actually, how can I validate that I'm running the latest beta?


Is there something special with the ns form of the file?

Mark Addleman15:04:54

There are only a couple of slightly odd things in my ns form: I have a lot of java imports and I end up loaded some JNI code.

Mark Addleman15:04:57

Here is the NS form:L

Mark Addleman15:04:06

(ns timez.spool.rocksdb
  (:refer-clojure :exclude [get])
  (:require [taoensso.nippy :as nippy]
            [timez.util :refer [name-hash]]
            [timez.spool.rocksdb.comparator :refer [java-comparator]]
            [taoensso.tufte :as tufte :refer (defnp p profiled profile)]
            [ :as j])
  (:import [org.rocksdb RocksDB Options Filter ReadOptions
                        Options Statistics RateLimiter
                        BloomFilter CompactionStyle
                        BlockBasedTableConfig ComparatorOptions
                        RocksIterator WriteBatch WriteOptions Comparator FlushOptions DBOptions ColumnFamilyDescriptor ColumnFamilyOptions]
           [timez.spool.rocksdb ClojureComparator]
           [org.rocksdb.util SizeUnit]
           ( File)
           (java.lang AutoCloseable)
           (java.util TreeMap ArrayList)))


Thanks. I'll have a look later to see if that is the problem. It really shouldn't be. Looks straight forward.


Maybe something else goes wrong.

👍 4

There is a command for loading the current namespace in the repl window. What did that give?

Mark Addleman16:04:36

Loading the namespace and all dependencies reports back the value of the last form in the file. This is expected

Mark Addleman16:04:59

However, when I try to refresh all namespaces in the project, I get

Mark Addleman16:04:09

Reloading all the things...
Error reloading: undefined
:error 😿

Mark Addleman16:04:59

More info: Goto definition does not work either


Have you jacked in, or started the repl manually?


Reloading needs some work, it seems. 😀

Mark Addleman17:04:06

I started the repl manually using lein repl and jacked in as described in the animated Calva tutorial (very cool, btw)


Never seen that tutorial. 😀


And if you try with Jack-in, did that work?

Mark Addleman18:04:54

Here is the order of operation: 1) start repl 2) start VS code and receive

Autoconnecting... (This can be disabled in Settings)
Hooking up nREPL sessions...
Connected session: clj
cljc files will use the clj REPL.
in Calva says

Mark Addleman18:04:20

3) Load file and dependencies, receive `Evaluating file: /home/markaddleman/dev/hitchhiker-tree/src/timez/spool/rocksdb.clj `

Mark Addleman18:04:38

4) Try and evaluate a selected form. Here, I get a new pane that opens titled "CLJ REPL" set to user namespace. I see (defonce _ (RocksDB/loadLibrary)) and then I get

Syntax error compiling at (/tmp/form-init6360033135029997688.clj:1:12).
No such namespace: RocksDB
class clojure.lang.Compiler$CompilerException

Mark Addleman18:04:50

This error is expected from the user namespace


@pez Ah -- I see you're saying I should use Calva: Evaluate selection or current form rather than Clava: Evaluate current top level form when I want to evaluate a selection that looks like:

(println :foo)
(println :baz)


When I do so, I get the same "close but no cigar" output in Calva says:

out: :foo

=> nil
The problems are (still) the extraneous out: and the extra newline.


@lspector Yeah, I’ll try fix the output to your liking.

❤️ 4

@mark340, you are highlighting an important glitch in the instructions for Calva 2. It should really promote the jack-in now… Try without starting the repl yourself, and instead use the command Start a project REPL and connect.

✔️ 4

Mostly improvements for cljs repl evaluations. Also fixing some situations when paredit stopped working.


This version broke all calva features. Lot's of errors, I had to go back to the earlier release


Wow. Did you go back to an earlier dev build our to the published one? Thanks for the report, btw!


to the earlier dev build, the previous one you published works with jack in


published here )


Thanks, I think I know what might be the problem then.