Fork me on GitHub
#calva
<
2021-04-20
>
cljs00:04:51

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

cljs00:04:04

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

cljs00:04:45

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

cljs00:04:52

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

cljs00:04:49

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

cljs00:04:58

Here is a snippet of the code I am running:

cljs00:04:58

(ns temp
  (:require [axios]))

(def resp-prom
  (.get axios ""))

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

cljs00:04:29

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

cljs00:04:44

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

djblue00:04:31

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

djblue00:04:29

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

djblue00:04:10

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

cljs02:04:34

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

cljs02:04:22

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

cljs00:04:25

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

cljs00:04:32

Any ideas on what the issue is here?

pez10:04:08

This prints 42 in the output window when I try:

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

pez10:04:18

@anonmail053: this also prints 42 :

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

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

yuhan12:04:33

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

yuhan12:04:50

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

pez12:04:10

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,

pez12:04:22

iirc, this is how I ended up choosing italics.

pez12:04:01

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

pez12:04:51

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

yuhan12:04:34

heh, I tried googling a bit but nothing came up

yuhan12:04:57

some sort of gutter marking might also be nice

pez12:04:16

Gutter markings are at least possible. 😃

pez12:04:33

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

yuhan12:04:26

ah, that's too bad

yuhan12:04:31

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

yuhan12:04:23

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

pez14:04:42

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.

Stuart14:04:34

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

pez14:04:26

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

yuhan17:04:32

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

yuhan17:04:00

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

bringe20:04:12

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
Stuart20:04:22

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.

Tomas Brejla16:04:17

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?

pez16:04:13

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

seancorfield17:04:28

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

bringe20:04:00

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

borkdude21:04:52

This is correct