Fork me on GitHub

Dear Calva friends. Joyride lets you do stuff like add a Restart clojure-lsp command to VS Code using a keybinding definition like this one:

        "key": "",
        "command": "joyride.runCode",
        "args": "(require '[promesa.core :as p]) (p/do (vscode/commands.executeCommand \"calva.clojureLsp.stop\") (vscode/commands.executeCommand \"calva.clojureLsp.start\"))"
Come on, join the #joyride!


It seems Calva breaks the disable wordwrap option in vscode. After I evaluate some code that has a long output, line is not wrapped.


Output results are never wrapped, if that is what you mean.


Yes. And that breaks the vscode wrap setting.


Even if we go on to edit the files, The wrap is not restored.


However, it also seems we can mitigate it, by truncating inline results. Please file an issue.


Great. Will do.

Erich Wolodzko23:05:32

Hey Calva community! This is certainly a beginner's question, but it seemed more related to Calva. Let me know if there is a better place to post. Is there a place in the getting started or on the website that explains the correct workflow for updating an existing REPL session after adding a new dependency to a project? I haven't managed to find anything yet — although admittedly I probably don't know the right thing to search for. The situation is that I just switched from the to creating my first Hello World lein app project. Everything was working great until I tried to add a dependency to my project.clj file, and now my REPL evaluations are failing with Syntax error compiling at... No such namespace: io. It makes sense that my REPL session would be stale, but what I've tried so far to update it — evaluating the updated (ns... ) form at the top of my file, selecting Calva: Load Current File and Dependencies — both fail with a different compiler FileNotFoundException exception. The confusing thing is that I've done lein deps on the command line, and I also checked that lein run works on the command line, so I don't know why my REPL in VS Code is failing to evaluate. I'm not sure what else is relevant to share at this point. I figured maybe there is part of the guide that I've missed that I can read up on. Probably I could just restart VS Code, but hoping to learn a better way. 🙂


There are ways to add dependencies to a running REPL but they're not widely used -- most folks tend to just restart their REPL.


Personally, I use a branch of tools.deps.alpha so that I can call add-libs on that branch and load additional dependencies without restarting my REPL. That's with the Clojure CLI.


I haven't used Leiningen for years for projects but I believe it bundles Pomegranate so you can use that from the REPL to load additional libraries. Maybe the Pomegranate docs have examples?


Here we go, based on what's in the Pomegranate README:

(! 521)-> lein repl
nREPL server started on port 61507 on host - 
user=> (require 'hiccup.core) ; fails: Hiccup is not in project.clj
Execution error (FileNotFoundException) at user/eval2043 (REPL:1).
Could not locate hiccup/core__init.class, hiccup/core.clj or hiccup/core.cljc on classpath.
user=> (require '[cemerick.pomegranate :refer [add-dependencies]])
user=> (add-dependencies :coordinates '[[hiccup "RELEASE"]]
  #_=>                   :repositories (merge cemerick.pomegranate.aether/maven-central
  #_=>                                        {"clojars" ""}))
{[hiccup "2.0.0-alpha2"] #{[org.clojure/clojure "1.5.1"]}, [org.clojure/clojure "1.5.1"] nil}
user=> (require 'hiccup.core)

Erich Wolodzko01:05:11

Thank you Sean! The add-dependencies functionality looks interesting. Honestly I'm perfectly happy starting my REPL if that's the common workflow. It just wasn't obvious to me if I should be able to do it, and I was trying to figure out if I was doing something wrong. By the way, separately in response to you side comment, I don’t have any particular affinity toward Leiningen, but after becoming somewhat confused or daunted trying to figure out what it would look like to use more recent tolls on Windows, I ended up concluding that lein might be a safer and easier way to get started on Windows as of now for a newcomer.


If you're comfortable with the command line, my recommendation on Windows is to use WSL2 - that's how I do all my work on Windows. VS Code, Calva, Remote extension. Then all code and REPLs on Ubuntu via WSL2

Erich Wolodzko01:05:32

Ah ok, I’ll give that a try at some point. I do use WSL2/Ubuntu for other stuff.


@U02F6BHUZH9 Feel free to DM me if you get stuck with the Clojure CLI etc on WSL2/Ubuntu.

Erich Wolodzko00:05:18

Thank you! Will do. Unfortunately I'm currently limited to doing this in my leisure time, but if/when I get a good enough chunk of time to give it a real attempt I will.