Fork me on GitHub
#calva
<
2023-08-04
>
Gabriel Rech21:08:31

Hi, probably a noob question here: I'm trying to use the calva.autoEvaluateCode feature but, whenever I add it to my settings.json, jack-in simply stops working. This is what I try adding (which should only be the default code):

"calva.autoEvaluateCode": {
    "onConnect": {
      "clj": "(when-let [requires (resolve 'clojure.main/repl-requires)] (clojure.core/apply clojure.core/require @requires))"
    },
  },
Looking at vs code logs:
2023-08-04 18:04:48.566 [error] TypeError: Cannot read properties of undefined (reading 'clj')
Can you tell me what am I doing wrong here?

seancorfield21:08:24

My settings.json file has this:

"calva.autoEvaluateCode": {

      "onConnect": {
        "clj": "(when-let [requires (resolve 'clojure.main/repl-requires)] (clojure.core/apply clojure.core/require @requires))",
        "cljs": "(try (require '[cljs.repl :refer [apropos dir doc find-doc print-doc pst source]]) (catch :default e (js/console.warn \"Failed to require cljs.repl utilities:\" (.-message e))))"
      },
      "onFileLoaded": {
        "clj": null,
        "cljs": null
      }
    },

seancorfield21:08:55

(Calva added that itself -- what version of Calva are you running @U04EUSW0ZUG?)

Gabriel Rech21:08:54

@U04V70XH6 It's 2.0.382 here. I have the same code as you under my default settings.json file, but for some reason when I add this to my user settings.json, it causes the issue.

seancorfield22:08:18

The above is from my user settings.json so I'm not quite sure what you mean about a "default" settings file?

Bob B22:08:09

I am able to re-create this in my user-level settings.json, and it seems to be resolvable by adding the onFileLoaded key. This shows a warning, but I'm still able to start the REPL

🙌 2
Gabriel Rech01:08:25

Ooh, that was the problem. I assumed I needed only to include the property I was overriding (in this case, onConnect), so I had not included onFileLoaded. Including the entire setting once again in user settings.json did the trick, thanks gratitude

Craig Brozefsky23:08:13

Is anyone offering Calva training?

bringe16:08:16

Not that I'm aware of. Do you have a desire for this? Would it be 1 on 1 or a training for a group? Is this corporate-related or otherwise?

bringe16:08:07

(I don't mean to imply that I have the bandwidth for that, I'm just curious.)

Craig Brozefsky22:08:33

Oh hey, sorry, just saw this. It would be for a corporate team, maybe 6 people or so. I'm a long-time clojure hacker, but I'm new to Calva and VS Code, and we have alot of newbs who are using it. I would like to give them a hand on using vs code, git, clojure repl driven dev, running tests easily etc.. Thinking a single session

bringe04:08:40

Aside from a live training session, you might find the CalvaTV YT channel helpful. See the playlists: https://www.youtube.com/@CalvaTV/playlists