This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-01-01
Channels
- # announcements (1)
- # babashka (1)
- # beginners (49)
- # calva (111)
- # chlorine-clover (2)
- # cider (2)
- # circleci (9)
- # clojure (60)
- # clojure-europe (25)
- # clojure-nl (4)
- # clojure-taiwan (2)
- # clojure-uk (10)
- # code-reviews (5)
- # conjure (1)
- # cryogen (2)
- # cursive (1)
- # data-science (1)
- # datomic (1)
- # figwheel-main (1)
- # fulcro (23)
- # hoplon (2)
- # malli (4)
- # meander (1)
- # off-topic (149)
- # other-languages (1)
- # re-frame (40)
- # reagent (27)
- # reitit (2)
- # shadow-cljs (25)
- # slack-help (4)
- # spacemacs (7)
- # xtdb (11)
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.
This looks really useful, thanks. Is there a way in VS Code command pallet to show all the Calva related functions?
I have some of the most useful key bindings added to vspacecode and they seem to work very well. There are lots of useful key bindings in the Evaluation sub-menu
There are still quite a few key bindings to add (I had forgotten how tedious and error prone writing json can be).
I've only needed to over-ride the Calva escape
key binding with space+escape
. I've added a , e l
key binding to clear all evaluations as well
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.
Initially starting with just languageId
, adding any when clauses if required
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
Happy New Year, @eugen.stan! I’m not sure what it takes to reload compiled classes. But StackOverflow suggests to leave a (comment (compile '
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
oke, I try to find out if there is a problem wth my setip or a problem in a crux 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[]
I have this on my project.clj file
:dependencies [[org.clojure/clojure "1.10.0"]
[juxt/crux-core "RELEASE"]]
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)
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
when I try this :
(defn -main[](
(crux/entity-history
(crux/db node #inst "2116-01-01T09")
:kaarlang/clients
:desc
{:with-docs? true})
))
(-main)
you could add an alias to run the main function https://stackoverflow.com/questions/11023762/leiningen-with-multiple-main-classes
(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)
))
you shuould define a :main
https://leiningen.org/
(defproject "1.0.0"
:description "Generate static HTML for "
:dependencies [[enlive "1.0.1"]
[cheshire "4.0.0"]
[org.markdownj/markdownj "0.3.0-1.0.2b4"]]
:main leiningen.web)
did :
(defproject practicalli/crux-demo "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url ""
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
:url " "}
:dependencies [[org.clojure/clojure "1.10.0"]
[juxt/crux-core "RELEASE"]]
:main tutorials.crux.jupiter
:target-path "target/%s"
:profiles {:uberjar {:aot :all}})
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
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).
follow this guide in a new file https://github.com/technomancy/leiningen/blob/stable/doc/TUTORIAL.md#running-code
(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})
I see this :
Caused by: java.lang.Exception: Cannot find anything to run for: practicalli.jupiter
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})
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.