+1 đ
For some time, I have been experiencing a delay in getting the exception when I try to evaluate an inline expression (inside VS code editor) with calva jacked-in. I am wondering if this has to do with my setup or this delay is expected. The delay is significant - about 20 sec. For example, if I evaluate (ok 2)
then I get the syntax error about ok
symbol issue after about 20 sec. I dont have anything extra beyond calvaâs defaults wrt evaluation process.
@amarjeet, Sounds like this issue: https://github.com/BetterThanTomorrow/calva/issues/929 I thought that problem was fixedâŚ
@pez thanks, let me update the cider/repl deps - will ping the status
Currently, when i jack-in, I have the following deps:
clojure -Sdeps '{:deps {nrepl {:mvn/version "0.8.2"} cider/cider-nrepl {:mvn/version "0.23.0"} clj-kondo {:mvn/version "2020.04.05"}}}' -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]
hey @pez , my deps.edn
file in the ~/.clojure
doesnât specify any specific version of nrepl
or cider/cider-nrepl
. Are these dependencies being automatically fetched by calva when i jack-in? I have these deps specified in lein
profile, but I am currently using with deps cli.
I guess it is up to lein
which dependency setting get priority. But I think the Calva injections takes priority. That looks like you are using an old version of Calva, btw. So if you upgrade, you should be good.
My calva version is one older than the current one, and re-installing in the vs code re-installs the same version unfortunately. I am gonna try to vs code update, followed by calva update
Yup, updating vs code let me update calva - now things are good đ thanks @pez
Calva has become better with new update
nice
although in some cases, I am not getting exception at all, its just blank. I will investigate a bit on this about scenarios in which such things are happening.
@zelark have updated the versions to the latest one. But, I am still facing the issues - in some cases I get the feedback, in some cases, no feedback at all for bad codes.
Unfortunately, this situation is random so far for me - canât identify patterns yet wrt to situations in which this occurs.
Awesome.
All the dependencies in this command are added by the Calva jack-in process.
The clojure
command will use the :paths
and :deps
from the project deps.edn file (and user wide .clojure/deps.edn
file if it has those keys).
No aliases are specified in the Clojure command, so none are use.
Calva doesn't allow the user to specify aliases from the user wide config, without adding even more config in Calva. This is another reason I use connect rather than jack-in
got it, cool
thanks
What is the best practice to know more about java instances, how to find methods of the instance in calva ? Is clojure.reflect/reflect the most elegant method?
Probably not news: https://clojure.org/guides/repl/data_visualization_at_the_repl#_dealing_with_mysterious_values_advanced
So how do you call refrect in practice, you just paste code in editor:
(comment
(require '[clojure.reflect :as reflect])
(require '[clojure.pprint :as pp])
(->> (reflect/reflect con) :members (sort-by :name) (pp/print-table [:name :flags :parameter-types :return-type]))
or is it possible to print this table on keyboard shotcut?You could maybe use custom commands for this. Not sure, but check this out and see if it could help: https://calva.io/custom-commands/
Tap current form should be built-in eh?
It isnât yet, but I agree.
I was listening a podcast about cursive and autor said that he implemented a trick that inspect is triggered at dot key down: (s. and when user selects the method (.toString) form is transfomed to (.toString s|)
or something like that
but the swaping object and method seems like a clever trick
I will try with custom command
That is a neat feature
I also used that reflect strategy recently when trying to do the same
Like so?
{
"name": "Inspect",
"repl": "clj",
"snippet": "(.toString $current-form)"
}
{
"name": "reflect",
"snippet": "(require '[clojure.reflect :as reflect]) (require '[clojure.pprint :as pp]) (->> (reflect/reflect $current-form) :members (sort-by :name) (pp/print-table [:name :flags :parameter-types :return-type]))",
"repl": "clj"
}
this works
Way cool. @claudius.nicolae pointed me in a direction that I think might make it possible to assign a direct keyboard shortcut to that. Check here: https://github.com/BetterThanTomorrow/calva/issues/1008