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`.
cljs 2021-04-20T00:35:51.083100Z

Hello, I had opened a github issue, and am looking for additional info for solving the problem I am having with Calva

cljs 2021-04-20T00:36:04.083400Z

I am trying to run a CLJS repl, and it works until I start using promises

cljs 2021-04-20T00:36:45.084Z

Whenever I run the promises, I never see the resolved output of the promise in the jack-in window

cljs 2021-04-20T00:37:52.084900Z

I see that a promise was fired (the window says #object[Promise [object Promise]] ), but then never see any resolved output in the window

cljs 2021-04-20T00:38:49.085900Z

For additional clarification, I am not using shadow-cljs or anything like that, just the plain vanilla node-repl with the CLJS dependency needed to compile CLJS in my deps.edn

cljs 2021-04-20T00:38:58.086200Z

Here is a snippet of the code I am running:

cljs 2021-04-20T00:39:58.087400Z

(ns temp
  (:require [axios]))

(def resp-prom
  (.get axios "<https://example.com>"))

(.then resp-prom #(js/console.log %))

cljs 2021-04-20T00:40:29.088100Z

my understanding is that I should see the output from the js/console.log after the promise resolves, but do not see any output

cljs 2021-04-20T00:40:44.088500Z

Is it possible I am using .then wrong and that is causing an issue?

cljs 2021-04-20T00:41:25.089300Z

also I am using the standard jack-in sequence, and then choosing node-repl when prompted for a repl

cljs 2021-04-20T00:41:32.089500Z

Any ideas on what the issue is here?

djblue 2021-04-20T00:45:31.089600Z

Is the promise isn't resolving successfully, it might be resolving unsuccessfully so maybe try .catch too

djblue 2021-04-20T00:46:29.089800Z

Ohh, it might also be that since this is async, js/console.log is printing somewhere else

djblue 2021-04-20T00:47:10.090Z

You could try https://github.com/djblue/portal#usage and see if you can tap> the value instead :thinking_face: #shameless-plug

cljs 2021-04-20T02:09:34.090300Z

Thank you, I will look into this, and will try using a catch block

cljs 2021-04-20T02:10:22.090500Z

If it is printing somewhere else, is there a way to redirect this to the running repl in the jack-in window?

pez 2021-04-20T10:48:08.094800Z

This prints 42 in the output window when I try:

(.then (js/Promise.resolve 42)
       #(js/console.log %))

pez 2021-04-20T10:57:18.095500Z

@anonmail053: this also prints 42 :

(def prom (new js/Promise
               (fn [resolve, reject]
                 (js/setTimeout
                  (fn [_]
                    (resolve 42))
                  5000))))

(.then prom #(js/console.log %))

yuhan 2021-04-20T12:04:33.096900Z

Hi, I wonder if it's possible to customize the commentFormStyle with backgroundColor, such that it extends across the entire width of the screen?

yuhan 2021-04-20T12:05:50.097900Z

I find this easier to tell at a glance than italics if you're in a comment form, but the jaggedness is quite distracting

pez 2021-04-20T12:19:10.099600Z

I don’t think so. Well, at least not how it is implemented today. Some googling on vscode.TextEditorDecorationType might dig up something we could use to make this possible,

pez 2021-04-20T12:20:22.100400Z

iirc, this is how I ended up choosing italics.

pez 2021-04-20T12:21:01.101100Z

(b/c I couldn’t style the background color of the lines.)

pez 2021-04-20T12:21:51.101500Z

But you can go pretty wild with glow effects and such. 😃

yuhan 2021-04-20T12:29:34.102Z

heh, I tried googling a bit but nothing came up

yuhan 2021-04-20T12:29:57.102500Z

some sort of gutter marking might also be nice

pez 2021-04-20T12:36:16.102900Z

Gutter markings are at least possible. 😃

pez 2021-04-20T12:38:33.104100Z

This seems to hint that adding background color beyond the content isn’t within reach: https://marketplace.visualstudio.com/items?itemName=matthewhazlehurst.line-highlighter

yuhan 2021-04-20T12:46:26.105100Z

ah, that's too bad

yuhan 2021-04-20T12:49:31.106900Z

I'm happy with the gutter solution, but somehow you can't just specify a color - I had to make a 1x1px image

yuhan 2021-04-20T12:53:23.107700Z

I tried setting overviewRulerColor too, but for some reason that disappears when you scroll off screen

pez 2021-04-20T14:50:42.109600Z

I have been wanting to have a marker for when a form is “dirty” compared to what the REPL has evaluated. Seems like the gutter would be a nice place to have such a marker.

2021-04-20T14:52:34.109700Z

Oooh. This is a great ideA!!! Would Iove this!

pez 2021-04-20T14:58:26.109900Z

I don’t think we have an issue for it. Just sayn’ 😃 If you want to file such an issue, be my guest. Would be good if we looked at what prior art there is. I think CIDER has a similar feature. (iirc, it marks up-to-date forms instead of the dirty ones).

Tomas Brejla 2021-04-20T16:56:17.111900Z

Hi. I always wondered... is there any support for project.clj or deps.edn in Calva? Features such as "schema" (or "sanity") "validation", code completion for dependencies or something similar? If not, would something like that even possible/achievable/usable?

pez 2021-04-20T16:58:13.113200Z

There isn’t. I think it would be super nice. Entirely possible too.

seancorfield 2021-04-20T17:00:28.113300Z

@brdloush clj-kondo checks deps.edn to some degree (and that’s built-in with Calva now, right?).

yuhan 2021-04-20T17:21:32.113900Z

hmm, what would count as a form being "dirty"?

yuhan 2021-04-20T17:25:00.114100Z

I guess when you (def x ...) and then def y (something x)) and then go back and change x?

pez 2021-04-20T19:41:15.116Z

New Calva out. A change in the ergonomics of one feature, an upstream bug fix and a fix for a regression that had snuck in: https://github.com/BetterThanTomorrow/calva/releases/tag/v2.0.191https://github.com/BetterThanTomorrow/calva/issues/644 • Fix: https://github.com/BetterThanTomorrow/calva/issues/1131 • Bump `cider-nrepl` to https://github.com/clojure-emacs/cider-nrepl/blob/master/CHANGELOG.md#02511-2021-04-12

3
🎉 2
bringe 2021-04-20T20:45:12.116400Z

I think it just means specifically if a form either: a) hasn't yet been evaluated b) has been edited since it was last evaluated

☝️ 2
bringe 2021-04-20T20:46:00.116700Z

It's built-in via clojure-lsp, yes.

2021-04-20T20:46:22.116900Z

Yeah, I'll often write a function, evaluate it, call it and see it doesn't work, change the function and forget to evaluate it. Then re-call it and confuse my simple brain for a minute.

borkdude 2021-04-20T21:26:52.117200Z

This is correct