Fork me on GitHub
Zach Mitchell, PhD00:10:35

I've noticed that Calva isn't picking up aliases in my deps.edn. For instance, I have a :dev alias that only defines :extra-paths ["dev"], but when I print out the classpath I don't see dev in there:

(doseq [p (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader)))]
    (println (str p)))
This is my full deps.edn:
{:paths   ["src" "resources"]
 :deps    {org.clojure/clojure        {:mvn/version "1.10.3"}
           ring/ring                  {:mvn/version "1.9.4"}
           metosin/ring-http-response {:mvn/version "0.9.1"}
           metosin/muuntaja           {:mvn/version "0.6.7"}
           metosin/reitit             {:mvn/version "0.5.11"}
           selmer/selmer              {:mvn/version "1.12.31"}
           integrant/integrant        {:mvn/version "0.8.0"}}
 :aliases {:run-m {:main-opts ["-m" "zmitchell.cardmates"]}
           :run-x {:ns-default zmitchell.cardmates
                   :exec-fn    greet
                   :exec-args  {:name "Clojure"}}
           :build {:deps       {io.github.seancorfield/build-clj {:git/tag "v0.4.0"
                                                                  :git/sha "54e39ae"}}
                   :ns-default build}
           :dev   {:extra-paths ["dev"]}
           :test  {:extra-paths ["test"]
                   :extra-deps  {org.clojure/test.check               {:mvn/version "1.1.0"}
                                 io.github.cognitect-labs/test-runner {:git/tag "v0.5.0"
                                                                       :git/sha "48c3c67"}}}}}
When I jacked-in I selected the :dev alias, but I don't see dev in the terminal output from the jack-in either:
clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version,"0.8.3"},cider/cider-nrepl {:mvn/version,"0.26.0"}}}'  -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]"
WARNING: Implicit use of clojure.main with options is deprecated, use -M
nREPL server started on port 50084 on host localhost - 
I'm on 2.0.218 for context.

Zach Mitchell, PhD00:10:40

Well, I feel silly. It looks like there's a checkbox that wasn't getting checked next to the alias in the dropdown during jack-in. I was navigating with my keyboard and was just hitting enter on the highlighted alias.


You are not silly. That VS Code Ux is silly. Trips a lot of people up.

👍 1
☝️ 1

Hm. Starting calva today (after reboot) gives me "Couldn't start client Clojure Language Client" in a small toast in the corner. Not sure yet what is affected, and can't see anything weird in "Calva says"


Heh, ok. I tried to jack in, and it says clojure cannot be found. Seems like for some reason it has lost the relevant folders from PATH


A problem completely outside Calva, but perhaps the original error could be made more explicit about clojure not being found?


clojure is not used to start clojure-lsp


Fixing the path (and it didn't bring anything except clj and clojure) did get rid of that error, though


In any case it is hard to report on clojure as missing when it is not involved in the error. 😃 clojure-lsp is a binary. No idea why it would need clojure or clj on the path. In fact I don’t think it does. I could be wrong, of course.


I think clojure-lsp uses clojure/clj to get the classpath during initialization for deps.edn projects. @UKFSJSM38 Do you think a more detailed error could be given from clojure-lsp when initialization fails?


Maybe it should use deps.clj instead? Maybe it could be used as a library by clojure-lsp even? WDYT, @U04V15CAJ?


@U0ETXRFEW Perhaps as a fallback when clojure cannot be found? Perhaps @U8ZQ1J1RR is on Windows? /cc @UKFSJSM38


What would be the point of not using it regardless and not bother to check for clojure?


Perhaps people have installed a newer (or older) version of clojure specifically for some bug fixes or so


So it would maybe be good to put this behind a flag or use as fallback or so


Then it is probably better to just do it as a fallback. Then clojure-lsp would just work even before clojure is installed, and also when it is installed.


clojure-lsp should start even without clojure, the clojure command is used only for detecting classpath of deps.edn project and clojure-lsp logs the error on it's log file


yes, and when clojure is missing it can't, that is what @U0ETXRFEW is referring to


see beginning of thread: "clojure not found"


Is it possible to get the classpath only with deps.clj?


just call (borkdude.deps/-main "-Spath")


it accepts the same args as the clojure CLI


It seems we could just drop the clojure command so? And rely on deps.clj?


I'd be fine with that


It seems we would remove a external dependency that may not be available for user and rely only on the deps.clj lib, it sounds good to me, please open an issue


But @U04V15CAJ also expressed reasons to only use deps.clj as a fallback in this same thread. Not sure if you saw that, @UKFSJSM38?


yeah the reason would be that the installed clojure version might be using a different tools jar version (and hence tools deps alpha) because something was broken in a newer or older version.


Hum, I see, yeah so maybe we could just silently fallback and log that


yes, and/or apply configuration setting in .lsp/config.edn to use the built-in deps stuff

👍 1

Seems unnecessary to burden the user with this setting, imo,


But what if they want to opt-in to this instead of using their installed version


could also be handy for triaging when people have problems with the installed one


Yeah, but also makes for more documentation that most people don’t need to read. It’s a trade-off, of course. Settings/configuration need to carry their weight, I think. I’m a Getting Real kind of guy, Make the call 😃


I don't really agree with that take. You can have options but hide them on the first glance. You can make a section with more advanced options for example where people only need to look in case of these triaging issues.


It comes down to: when shit hits the fan, give yourself options. (like: yes, a REPL in production)


It's different from: let clients choose 100 different colors for their outer parens


Yep, Lots of possibilities. 😃 Still, settings need to be maintained. I try to avoid them as long as I can, and only add when I need to.


> It’s different from: let clients choose 100 different colors for their outer parens Calva users can. 😃


Sure. But in a case like this, you don't want to mess with how dependencies are downloaded unless users explicitly agree, I think


We agree on deps.clj only being used as a fallback. I’m only questioning the make-it-a-setting part.


Even if you use it as a fallback, you might want to have the option to "force" using it, e.g. when there is something wrong with the fallback logic, or otherwise (clojure / powershell install is detected, but doesn't work for some reason).


Also people might want to opt into deps.clj not as a fallback, because it has some options (e.g. selecting a different tools jar)


Yes, not disagreeing there either. It is a trade-off.


Didn't quite read the thread, but no, heh, I'm not on Windows. deps.edn projects on Linux, though that error comes before I try to jack in so I don't know if that really matters


@U8ZQ1J1RR It’s not related to jack-in, just FYI. It’s related to clojure-lsp initializing when you open a Clojure project in VS Code. The deps.clj fallback sounds like a good idea. I don’t think it would solve the problem of a similar issue happening with a lein project, but at least it fixes the deps.edn project issue.


Yeah, could you open an issue on clojure-lsp?


Sure, though I don't quite understand which parts are calva and which lsp, but at least you know the context from here


Calva v2.0.219 out. It updates the syntax grammar to better match the semantic tokens we get from clojure-lsp and also provides mappings token->grammar so that the semantic aware themes knows how to style the tokens to match the grammar. To the user this translates to much less visual flicker when clojure-lsp is started and when new files are opened. See for the longer story.

🎉 5

Something very odd has happened with the repl output. Before, a lazy seq of maps pretty printed the maps (each key-value on a separate line etc) and only printed some values. Now it all gets out, in one long stream without any formatting


Coloring seems to depend on data size. Just a couple of lines worth of data gets the usual colors of blue kws, red strings etc, but longer output is just white


Seems like .216 still pretty printed, but .217 not anymore


I’ve confirmed this. It may be related to this change: CC @U0ETXRFEW


@U0ETXRFEW, if I click the button in the status bar to turn pretty printing off, then click it again, pretty printing works. Before that, though, pretty printing does not work even though it’s enabled.


(At least, it looks enabled in the status bar.)


Thanks for reporting, both of ya! As for coloring. VS Code doesn’t syntax highlight lines above a certain length, for performance reasons. I think that is what might explain the whiteness. You can confirm that, @U8ZQ1J1RR, by decreasing the limit dramatically and throw evaluation that result in short ranges of forms at the REPL.


That makes sense, I guess, and I don't really have a need to highlight that long lines anyway. They are already unreadable


Hey everyone. I’ve noticed that I’m not longer getting the helpful auto-creation of the namespace header, eg (ns my-new.file) , upon creation of a new file. Is this a setting that I may have accidentally disabled?


Seems like it’d be an issue with clojure-lsp:


I’m on 2021.09.30-15.28.01 of clojure-lsp, I have it set to “latest”


Hi! Are you on Windows, perhaps? There is also this clojure-lsp related issue:


I think that one could be a regressions from when we upgraded the language client dependencies.


I’m on Mac


Ah okay, that would make sense


Anything you’d like me to try?


You can try with version 216 of Calva and see if it works there. If it doesn’t, then this could be clojure-lsp itself somehow and you could try with some older version of that.


Will do, ty


Hey folks, recently I have been experiencing this problem on multiple different projects, where when I try to Calva JackIn (or connect to a running REPL) the Output Panel hangs and does not connect properly, hanging in the ; Jacking in... phrase. Usually I need to Quit and re-open the VSCode to be able to JackIn with success again, not sure exactly when it started to happen, but I believe it was about a month ago or so. Anything that changed that could be related to this problem?


I have the exact same problem and have not been able to figure that out @leoiacovini


I can’t recall anything special changing in Calva that would cause that. It would be great if you could test that. Check the Changelog for info about where to start some bisecting. VS Code makes it easy to use older versions of an extension, but of course, it is quite a lot of work. It needs to be done on a machine where we can repro this, though….


Yeah we talked about this already. There is not really a precise way to replicate this, and I cannot tell whether is the nrepl that is not working or Calva that’s struggling to connect to the nrepl


I do recall when trying to connect Calva manually to the allegedly running Repl I received a socket error or something like that


I’m thinking: If you run with an older version of Calva a couple of days, and this doesn’t happen, then we might have an indication that this is a change in Calva causing it.


I will try to run some bissections, but its kinda hard to get this tested because the error is intermittent and seems to happen just after the VSCode is opened for some time (dirty state? ENV/Creds caching?). Anyway, I will try to dig a bit deeper

🙏 1

Yes, very tricky to catch this one. And there is still the possibility that it is something outside that has changed, that we can’t catch by bisecting Calva versions…