Fork me on GitHub
#calva
<
2019-04-21
>
lspector02:04:07

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

:baz
=> nil

lspector02:04:04

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.

lspector03:04:50

@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.

pez08:04:24

@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.

lspector14:04:01

@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)

pez14:04:13

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. 😃

mark34015: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?

mark34015:04:11

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

pez15:04:28

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

pez15:04:53

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

mark34015:04:09

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

pez15:04:14

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

mark34015: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.

mark34015:04:57

Here is the NS form:L

mark34015: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)]
            [clojure.java.data :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)))

pez16:04:34

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

pez16:04:52

Maybe something else goes wrong.

pez16:04:22

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

mark34016:04:36

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

mark34016:04:59

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

mark34016:04:09

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

mark34016:04:59

More info: Goto definition does not work either

pez16:04:14

Have you jacked in, or started the repl manually?

pez16:04:05

Reloading needs some work, it seems. 😀

mark34017:04:06

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

pez18:04:33

Never seen that tutorial. 😀

pez18:04:01

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

mark34018: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

mark34018:04:20

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

mark34018: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

mark34018:04:50

This error is expected from the user namespace

lspector20:04:10

@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)

lspector20:04:08

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

out: :foo

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

pez20:04:07

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

pez21:04:26

@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.

pez22:04:45

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

dennisa08:04:17

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

pez09:04:56

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

dennisa22:04:50

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

dennisa22:04:15

published here )

pez05:04:52

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