This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-04-21
Channels
- # announcements (8)
- # beginners (22)
- # calva (42)
- # cider (2)
- # clj-kondo (1)
- # cljdoc (3)
- # clojure (63)
- # clojure-chicago (1)
- # clojure-uk (29)
- # clojurescript (16)
- # clojureverse-ops (2)
- # core-matrix (6)
- # cursive (1)
- # datomic (23)
- # emacs (1)
- # heroku (2)
- # luminus (1)
- # off-topic (47)
- # pathom (1)
- # planck (3)
- # re-frame (4)
- # reitit (1)
- # rewrite-clj (5)
- # shadow-cljs (47)
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
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. 😃
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?
btw, I'm running with the latest beta from this channel
Actually, how can I validate that I'm running the latest beta?
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.
Here is the NS form:L
(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)))
Thanks. I'll have a look later to see if that is the problem. It really shouldn't be. Looks straight forward.
There is a command for loading the current namespace in the repl window. What did that give?
Loading the namespace and all dependencies reports back the value of the last form in the file. This is expected
However, when I try to refresh all namespaces in the project, I get
Reloading all the things...
Error reloading: undefined
:error 😿
More info: Goto definition does not work either
I started the repl manually using lein repl
and jacked in as described in the animated Calva tutorial (very cool, btw)
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
3) Load file and dependencies, receive `Evaluating file: /home/markaddleman/dev/hitchhiker-tree/src/timez/spool/rocksdb.clj `
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
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
:baz
=> nil
The problems are (still) the extraneous out:
and the extra newline.@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.
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