calva

Wednesdays you might find @U0ETXRFEW in the Gather Calva space. Invite is https://gather.town/invite?token=GZqrm7CR and the password is `Be kind`.
Eric Uitbeijerse 2021-02-02T07:43:03.056900Z

+1 😉

amarjeet 2021-02-02T09:05:35.061100Z

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.

pez 2021-02-02T09:10:48.062Z

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

amarjeet 2021-02-02T09:16:18.062800Z

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

amarjeet 2021-02-02T09:17:19.063300Z

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]

amarjeet 2021-02-02T09:31:13.065700Z

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.

pez 2021-02-02T09:37:09.067400Z

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.

amarjeet 2021-02-02T09:42:54.068600Z

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

amarjeet 2021-02-02T09:57:50.069200Z

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

amarjeet 2021-02-02T09:58:04.069500Z

Calva has become better with new update

❤️ 1
amarjeet 2021-02-02T09:58:06.069700Z

nice

amarjeet 2021-02-02T10:04:21.070600Z

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.

amarjeet 2021-02-03T08:58:39.086600Z

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

amarjeet 2021-02-03T08:59:52.086800Z

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

pez 2021-02-02T10:07:43.070900Z

Awesome.

practicalli-john 2021-02-02T10:27:38.071400Z

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

amarjeet 2021-02-02T10:43:01.071600Z

got it, cool

amarjeet 2021-02-02T10:43:06.071800Z

thanks

janezj 2021-02-02T19:39:09.082400Z

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?

janezj 2021-02-02T20:08:43.082800Z

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?

pez 2021-02-02T20:27:53.083Z

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/

clyfe 2021-02-02T20:33:15.083300Z

Tap current form should be built-in eh?

pez 2021-02-02T20:35:57.083500Z

It isn’t yet, but I agree.

janezj 2021-02-02T20:42:39.083700Z

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

janezj 2021-02-02T20:43:28.084Z

or something like that

janezj 2021-02-02T20:44:31.084200Z

but the swaping object and method seems like a clever trick

janezj 2021-02-02T20:44:55.084400Z

I will try with custom command

bringe 2021-02-02T20:48:37.084700Z

That is a neat feature

bringe 2021-02-02T20:49:31.084900Z

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

pez 2021-02-02T20:55:05.085100Z

Like so?

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

janezj 2021-02-02T21:10:23.085300Z

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

1
janezj 2021-02-02T21:10:39.085500Z

this works

pez 2021-02-02T21:31:49.085700Z

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