Thank you for all your work @pez and the rest of the Calva team!
Happy new year.
Is there a list of Calva function names or some API docs?
I'd like to add key bindings to VSpaceCode that call Calva functions. For example, defining , e f
to evaluate a top level form by calling a function such as calva.evalCurrentTopLevelForm
Alternative, I guess I could clone the Calva project and poke around and hopefully use auto-complere to discover function names.
Thanks.
If you open the Calva extension in the Extensions pane, there is a tab there Feature Contributions and in there you find a section for Commands. Most commands take no arguments.
Awesome! Let’s see when you come to paredit. Haha.
paredit seems just as straight forward. There seem to be more paredit commands than I am familiar with, so will require a bit of though about the keys to use The rewrap function is part of refactor in Spacemacs, but it makes sense to add it in structured editing using the same key binding as Calva - i.e. using the ({[" pscq keys I believe I can skip the selecting s-expressions of paredit, as VSpaceCode already has the same selection tools that seem to work.
I’d be very interested in publishing any bindings you produce that way on http://calva.io somewhere.
Some (I guess most) shortcuts are contextual, using the when
clause. I don’t know what VSpaceCode allows, but anyway, to find the when
clauses, open the Keyboard Shortcuts pane and look for the commands.
happy new year !
is there a way to reload compiled classes in Calva? Right now I just close vscode, open and re-jack-in . I compile java classes with gen-class that I need to reload
or at least a command to restart and re-jack in without closing vscode ?
@eugen.stan happy new year from the Netherlands
Happy New Year, @eugen.stan! I’m not sure what it takes to reload compiled classes. But StackOverflow suggests to leave a (comment (compile '<http://name.space|name.space>))
in the file. Where the comment hides the compile command from itself. Then you should be able to use Calva’s Evaluate Top Level Form on that.
To restart the REPL, if it is started with Jack-in, you can use the Disconnect REPL command. I’m not sure that is going to stay like that, because it is a bit weird that disconnect also jacks out, I think. But what you can rely on to remain is that if you jack-in again, the process will start with jacking out. So I change my suggestion to “Just jack in again” 😃 .
New Year’s release of Calva, v2.0.144, with these changes: • https://github.com/BetterThanTomorrow/calva/issues/915 • https://github.com/BetterThanTomorrow/calva/issues/910 • https://github.com/BetterThanTomorrow/calva/issues/904 See these docs for info about loading current namespace in the repl window https://calva.io/output/#load-current-namespace
installling right now
are there here some people who work in linux ?
or wsl2
I work on linux
oke, I try to find out if there is a problem wth my setip or a problem in a crux tutorial
are you willing to try some code ?
yep, and very very difficult to find out what causes the issue
sure
let's write here
expeciallty the entity-history part
with my it hangs and with the tutorial maker it works
oke
this works not on my computer and works on the computer of the maker of this tutorial
;; tag::require[]
(ns tutorials.crux.earth
(:require [crux.api :as crux]))
;; end::require[]
;; tag::node[]
(def node (crux/start-node {}))
;; end::node[]
;; tag::manifest[]
(def manifest
{:crux.db/id :manifest
:pilot-name "Johanna"
:id/rocket "SB002-sol"
:id/employee "22910x2"
:badges ["SETUP"]
:cargo ["stereo" "gold fish" "slippers" "secret note"]})
;; end::manifest[]
;; tag::submit[]
(crux/submit-tx node [[:crux.tx/put manifest]])
;;=>#:crux.tx{:tx-id 0, :tx-time #inst "2020-06-18T13:54:08.375-00:00"}
;; end::submit[]
;; tag::check[]
(crux/entity-history (crux/db node) :manifest :asc)
;;=> {:crux.tx/tx-time #inst "2020-06-18T13:54:08.375-00:00",
;; :crux.tx/tx-id 0,
;; :crux.db/valid-time #inst "2020-06-18T13:54:08.375-00:00",
;; :crux.db/content-hash #crux/id "0ab888b62775eea2eb2fffe10c9f6bfbf661a792"}
;; end::check[]
are you sure? code samples do not always work
yep, I talked with her the whole afternoon and we cannot solve it
ok, so i need the dependency and also the runing db?
please share the crux dependency line
oke
I have this on my project.clj file
:dependencies [[org.clojure/clojure "1.10.0"]
[juxt/crux-core "RELEASE"]]
does this help ?
Initially starting with just languageId
, adding any when clauses if required
yep., it also seems to work on your computer
have you restarted you repl?
several times
you are using def and from what I kno that is not the best way to handle it
hmm
I'm using clojure 1.10.1
have you restarted your computer ? 🙂
nope
java -version
openjdk version "1.8.0_275"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_275-b01)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.275-b01, mixed mode)
uname -a
Linux daos-495 5.9.0-5-amd64 #1 SMP Debian 5.9.15-1 (2020-12-17) x86_64 GNU/Linux
`
java -version
openjdk version "11.0.9.1" 2020-11-04
OpenJDK Runtime Environment (build 11.0.9.1+1-Ubuntu-0ubuntu1.20.04)
OpenJDK 64-Bit Server VM (build 11.0.9.1+1-Ubuntu-0ubuntu1.20.04, mixed mode, sharing)
well, good luck, I hope it helps
roelof@DESKTOP-GKSR5BK:~/banking$ uname -a
Linux DESKTOP-GKSR5BK 4.19.128-microsoft-standard #1 SMP Tue Jun 23 12:58:10 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
tried with java 11 also
thanks, im out of ideas
have you tried to run it from a main (outside of REPL)?
it does seem to be a setup issue
no, I do not know how I then can run it
give me a few minutes
take your time
do you have clojure / clj tools installed?
yep
when I try this :
(defn -main[](
(crux/entity-history
(crux/db node #inst "2116-01-01T09")
:kaarlang/clients
:desc
{:with-docs? true})
))
(-main)
it stil seems to hang
you should not call (-main)
oke
I wil not doing anything till you say so
you could add an alias to run the main function https://stackoverflow.com/questions/11023762/leiningen-with-multiple-main-classes
?? I do not have any or only 1 main in this project
ok, then make leiningen run this main
(defn -main []
(let [node (crux/start-node {})
manifest {:crux.db/id :manifest
:pilot-name "Johanna"
:id/rocket "SB002-sol"
:id/employee "22910x2"
:badges ["SETUP"]
:cargo ["stereo" "gold fish" "slippers" "secret note"]}]
(crux/submit-tx node [[:crux.tx/put manifest]])
(crux/entity-history (crux/db node) :manifest :asc)
))
oke, how do I do that
in repl I see this output : #'tutorials.crux.jupiter/-main
you shuould define a :main
https://leiningen.org/
(defproject <http://leiningen.org|leiningen.org> "1.0.0"
:description "Generate static HTML for <https://leiningen.org>"
:dependencies [[enlive "1.0.1"]
[cheshire "4.0.0"]
[org.markdownj/markdownj "0.3.0-1.0.2b4"]]
:main leiningen.web)
define the ns that contains the -main function
https://github.com/technomancy/leiningen/blob/stable/doc/TUTORIAL.md#running-code
did :
(defproject practicalli/crux-demo "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "<http://example.com/FIXME>"
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
:url "<https://www.eclipse.org/legal/epl-2.0/>"}
:dependencies [[org.clojure/clojure "1.10.0"]
[juxt/crux-core "RELEASE"]]
:main tutorials.crux.jupiter
:target-path "target/%s"
:profiles {:uberjar {:aot :all}})
hmm, does not work
I have this in my file
(defn -main []
(let [node (crux/start-node {})
manifest {:crux.db/id :manifest
:pilot-name "Johanna"
:id/rocket "SB002-sol"
:id/employee "22910x2"
:badges ["SETUP"]
:cargo ["stereo" "gold fish" "slippers" "secret note"]}]
(crux/submit-tx node [[:crux.tx/put manifest]])
(crux/entity-history (crux/db node) :manifest :asc)
))
do this in the repl
tutorials.crux.jupiter=> (require 'tutorials.crux.jupiter)
nil
tutorials.crux.jupiter=> (tutorials.crux.jupiter/-main)
Syntax error compiling at (form-init6925765827011711183.clj:1:1).
No such var: tutorials.crux.jupiter/-main
what does lein run
give ?
(put a println inside main fn
defn -main
I gave you the code above
lein repl
lein run
Gives
Can't find 'tutorials.crux.jupiter' as .class or .clj for lein run: please check the spelling.
Exception in thread "main" Syntax error compiling at (/tmp/form-init17099874963866708404.clj:1:74).
yep, and that one I use. the one you gave me
follow this guide in a new file https://github.com/technomancy/leiningen/blob/stable/doc/TUTORIAL.md#running-code
once you have that working, you can switch to your crux sample
chips, wrong file
this one works fine
can you try this one
(ns practicalli.earth
(:require [crux.api :as crux]))
(def node (crux/start-node {}))
(defn easy-ingest
"Uses Crux put transaction to add a vector of documents to a specified
node"
[node docs]
(crux/submit-tx node (mapv (fn [doc] [:crux.tx/put doc]) docs)))
(crux/submit-tx
node [[:crux.tx/put {:crux.db/id :kaarlang/clients
:clients [:encompass-trade]}
#inst "2110-01-01T09"
#inst "2111-01-01T09"]
[:crux.tx/put {:crux.db/id :kaarlang/clients
:clients [:encompass-trade :blue-energy]}
#inst "2111-01-01T09"
#inst "2113-01-01T09"]
[:crux.tx/put {:crux.db/id :kaarlang/clients
:clients [:blue-energy]}
#inst "2113-01-01T09"
#inst "2114-01-01T09"]
[:crux.tx/put {:crux.db/id :kaarlang/clients
:clients [:blue-energy :gold-harmony :tombaugh-resources]}
#inst "2114-01-01T09"
#inst "2115-01-01T09"]])
(crux/entity-history
(crux/db node #inst "2116-01-01T09")
:kaarlang/clients
:desc
{:with-docs? true})
with me it hangs on the entity-history ?
See you did
sorry I lost it
but when I do you main now
I see this :
Caused by: java.lang.Exception: Cannot find anything to run for: practicalli.jupiter
sorry I don't have time to try out things
I think the last error is because you don't have a -main fn
oke, it worked now
I see hello
because I added a (print "hello)
to the main
bu that on is not the code that fails on my computer
yeah, sorry I can't help you there
that is this code :
(crux/entity-history
(crux/db node #inst "2116-01-01T09")
:kaarlang/clients
:desc
{:with-docs? true})
and with this code ;
(defn -main []
(print "Hello")
(crux/db node #inst "2116-01-01T09")
:kaarlang/clients
:desc
{:with-docs? true})
I see hello and then a waiting cursor for a vey long time
If you can provide a complete project in a github repo that can be pulled down and the steps you take up until you have an issue, it may be easier for someone to help, so that you can be sure things are the same at least code-wise, and be able to know if it's some external setup issue.
There is a complete github repo and I already noticed that on 2 persons it worked and on my the same code does not work