Fork me on GitHub
#calva
<
2021-02-02
>
amarjeet09:02:35

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.

pez09:02:48

@amarjeet, Sounds like this issue: https://github.com/BetterThanTomorrow/calva/issues/929 I thought that problem was fixed…

amarjeet09:02:18

@pez thanks, let me update the cider/repl deps - will ping the status

amarjeet09:02:19

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]

practicalli-johnny10:02:38

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

amarjeet10:02:01

got it, cool

amarjeet09:02:13

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.

pez09:02:09

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.

amarjeet09:02:54

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

amarjeet09:02:50

Yup, updating vs code let me update calva - now things are good 🙂 thanks @pez

amarjeet09:02:04

Calva has become better with new update

❤️ 3
amarjeet10:02:21

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.

alekszelark07:02:25

You need to update nrepl-cider to the latest.

amarjeet08:02:39

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

amarjeet08:02:52

Unfortunately, this situation is random so far for me - can’t identify patterns yet wrt to situations in which this occurs.

pez10:02:43

Awesome.

janezj19:02:09

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?

janezj20:02:43

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?

pez20:02:53

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/

clyfe20:02:15

Tap current form should be built-in eh?

pez20:02:57

It isn’t yet, but I agree.

janezj20:02:39

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

janezj20:02:28

or something like that

janezj20:02:31

but the swaping object and method seems like a clever trick

janezj20:02:55

I will try with custom command

bringe20:02:37

That is a neat feature

bringe20:02:31

I also used that reflect strategy recently when trying to do the same

pez20:02:05

Like so?

{
            "name": "Inspect",
            "repl": "clj",
            "snippet": "(.toString $current-form)"
        }

janezj21:02:23

{
            "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"
        }

catjam 3
janezj21:02:39

this works

pez21:02:49

Way cool. @UCCHXTXV4 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