Fork me on GitHub

First time Calva user, Loading Current file and Dependencies for a .cljs file errors:


I have (only this) in dev/portal.cljs :

(ns tooling.portal
   [portal.web :as p]))
Sending the file errors, with the screenshot. How do I debug/get to the bottom of this? This loads in Cursive. • It is a Generic connected REPL • From which I start Figwheel manually, once connected to the CLJ REPL • That starts a CLJS REPL that I can evaluate it happily. • If I copy and paste that snippet to the CLJS REPL, it works. And switches to the ns. • From there I can open a Web Portal too, so that all works.


Does the generic connected REPL have cider-nrepl and piggieback dependencies? Currently Calva does a bad job at checking this, but it is needed.


I found the CLJ/CLJS toggle. And toggling that I get new behaviour:


It seems to be evaluating in the CLJ context?


The nrepl alias:


Got it. Running “Select CLJS Build Connection” made it work.


Now I need to figure out how make this much smoother for the future Calva newbie on our project. Steps I take: • Start an nREPL with piggieback and cider-nrepl • Connect to that via Generic, In Project. • Start figwheel, which drops into a CLJS REPL • Run “Select CLJS Build Connection” • Load dev/portal.cljs successfully.


Is there any way to minimise those steps?


I had forgotten about the “Select CLJS Build Connection” command. 😃 Is it a Figwheel Main project?


And connecting with Figwheel Main option doesn’t work?


When prompted for which builds to start, I chose “common” and “local”. When it started and asked which build to connect to, I chose “local” and got “Build local isn’t registered. Did you start it?”


(defn start-cljs-repl []
  (let [read-build (figwheel.main.api/read-build "common" "local")
        build-id   (:id read-build)]
      (figwheel.main.api/start {:mode :serve} read-build)
      (figwheel.main.api/cljs-repl build-id)
      (catch RuntimeException _e
        (println "The build is already running, connection to the REPL only")
        (figwheel.main.api/cljs-repl build-id)))))


I merge my builds, so I am not sure if Calva deals with that


Probably not, I didn’t know merging builds was a thing even.


Do you think you can create a small reproduction repo I can have a look at?


For now, this seems to be true: • When connected via Generic • And starting a figwheel manually • I have to manually “Toggle the REPL connection” for both output.calva-repl and my portal.cljs. Is there a hook somewhere that I can hook into?


And only after Toggling, can I “Select CLJS Build connection”, which chooses “generic” as the only one.


I am super impressed you found that way of doing it.


We should try to see if we can get the Figwheel Main connection sequence to work, I think.


Sorry, not answering your question. The way to automatically toggle the connection is to use the connect sequence. A custom connect sequence might work, but the error you get indicates that you will end up in the same place.


Thank you for taking the time in this conversation!


You are welcome!


Right back at you for the repro. Can you add some info to it about what a merged build is?

👍 1

I pushed a PR to the repro repo. Think I moved things forward a bit. Will try to find some more time tonight to look at it.


Fun with linter. I'm not sure if #calva is the right place to ask this, but I'm starting here as it's the bit I interact with. I'm using vs code. I've got calva v2.0.225. I'm in a project with fulcro (forked from Fulcro's macros like defresolver do NOT get recognised (should be resolved as defn). I have been having trouble with actions from the quick actions menu doing anything - for instance, move to let doesn't work from ctrl+. but it DOES work from ctrl+p. For resolve macro as I started with trying the quick action 'resolve macro <...> as' from ctrl+., but it did nothing, per the more general problem I'm having. Then I tried from ctrl+p, and get this dialog. I've now tried looking at the clj-kondo config more directly using the import instructions here, but the 'to activate' instructions printed,don't match the directories created in ./clj-kondo/clj-kondo. It created ./clj-kondo/clj-kondo/fulcro/config.edn The instructions say

Imported config to .clj-kondo/com.fulcrologic/fulcro. To activate, add "com.fulcrologic/fulcro" to :config-paths in .clj-kondo/config.edn. 
Thanks in advance!


Hello! It makes sense to start here with Calva. Have a look in this thread and see if you find some useful info.


Ah, you’ve already found it. 😃

😂 1

@U2LUY0P8B fulcro already has a configuration for clj-kondo


after your project is initialized by clojure-lsp, you should get a .clj-kondo/com.fulcro.bla/fulcro directory


all you have to do is add this to :config-paths in your .clj-kondo/config.edn


thanks @U0ETXRFEW yes, I'd seen the thread, but it seemed to jump from "there's a problem" to "it now works" and I wasn't sure I could see what the resolution was 🙂


oh, a typo! (for grumplet, maybe not mine 🙂


hmm, so neither my project, nor @U0522TWDA fulcro-intro work ootb. Neither of them have a ./clj-kondo/config.edn I've tried creating one with

{:config-paths ["com.fulcrologic/fulcro" "com.wsscode/async" "com.wsscode/pathom"]}
And now @U0522TWDA intro project gives me
[Info  - 2:24:54 PM] Clj-kondo language server loaded. Please report any issues to .
[Error - 2:24:54 PM] java.lang.IllegalArgumentException: No implementation of method: :as-file of protocol: #' found for class: clojure.lang.Symbol
	at clojure.core$_cache_protocol_fn.invokeStatic(core_deftype.clj:583)
	at $fn__11366$G__11348__11371.invoke(io.clj:35)
	at $file.invokeStatic(io.clj:424)
	at clj_kondo.impl.core$sanitize_path.invokeStatic(core.clj:88)
	at clj_kondo.impl.core$sanitize_paths$fn__15867.invoke(core.clj:97)
	at clojure.core$keep$fn__8559.invoke(core.clj:7337)
	at clojure.lang.LazySeq.sval(
	at clojure.lang.LazySeq.seq(
	at clojure.lang.RT.seq(
	at clojure.core$seq__5402.invokeStatic(core.clj:137)
	at clojure.core$map$fn__5866.invoke(core.clj:2746)
	at clojure.lang.LazySeq.sval(
	at clojure.lang.LazySeq.seq(
	at clojure.lang.RT.seq(
	at clojure.core$seq__5402.invokeStatic(core.clj:137)
	at clojure.core.protocols$seq_reduce.invokeStatic(protocols.clj:24)
	at clojure.core.protocols$fn__8146.invokeStatic(protocols.clj:75)
	at clojure.core.protocols$fn__8146.invoke(protocols.clj:75)
	at clojure.core.protocols$fn__8088$G__8083__8101.invoke(protocols.clj:13)
	at clojure.core$reduce.invokeStatic(core.clj:6824)
	at clj_kondo.impl.core$resolve_config_paths.invokeStatic(core.clj:112)
	at clj_kondo.impl.core$resolve_config_paths.invoke(core.clj:106)
	at clj_kondo.impl.core$process_cfg_dir.invokeStatic(core.clj:86)
	at clj_kondo.impl.core$resolve_config.invokeStatic(core.clj:132)
	at clj_kondo.core$run_BANG_.invokeStatic(core.clj:107)
	at clj_kondo.lsp_server.impl.server$lint_BANG_$fn__16141.invoke(server.clj:132)
	at clj_kondo.lsp_server.impl.server$lint_BANG_.invokeStatic(server.clj:131)
	at clj_kondo.lsp_server.impl.server.LSPTextDocumentService.didOpen(server.clj:150)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(
	at java.base/java.lang.reflect.Method.invoke(
	at$$Lambda$36/00000000E861ECB0.apply(Unknown Source)
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleNotification(
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(
	at java.base/java.util.concurrent.Executors$
	at java.base/
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(
	at java.base/java.util.concurrent.ThreadPoolExecutor$
	at java.base/

Jakub Holý (HolyJak)14:11:04

Hm, I guess I should add the kondo config. Though lsp-clojure perhaps auto-creates it? No idea about the exception :(


ah the project loads, there's a blissful little moment where I've got no red underlining, but it's just because the lsp hasn't kicked in yet 😢 😆


@U2LUY0P8B Can you reproduce this with the original fulcro rad demo?


If you can make it so anyone of us can reproduce locally, I'm willing to take a look

🙇 1

I'll give it a go!


good news and bad news. Good news for you guys, it works (nearly) out of the box! Bad news for me. I've no idea what I've done differently. 😞 It didn't work on cloning, but i let the lsp/kondo/whatever create the .clj-kondo/ folders, and it wasn't working. But I manually added ./clj-kondo/config.edn with content {:config-paths ["com.fulcrologic/fulcro" "com.wsscode/async" "com.wsscode/pathom"]} , reloaded the window, and it works beautifully!


yes, that's how it should work

👍 1

Thanks to @U0522TWDA we figured out where it was going wrong. A) the lack of .clj-kondo/config.edn B) for some reason we've not identified the .clj-kondo/com.wsscode/ paths aren't created in that project. I copied them over from the fulcro-intro-workshop and it's now working! 🙂


@U0522TWDA did also note that my clojure-lsp takes an unusually long time to start. He mentioned some docs about turning on logging to see what's taking the time. I might look at that today.


Thanks all for the help! I look forward to an even more enjoyable experience free from red underlining 🙂


thanks @U9A1RLFNV I'll take a look 🙂

👍 1

Ran into the same issue. Specifically, there was no .clj-kondo/config.edn; after adding it, all is well. Is this something that should happen automatically, or should I remember to do it when creating a new project?


> @U0522TWDA did also note that my clojure-lsp takes an unusually long time to start. He mentioned some docs about turning on logging to see what's taking the time. I might look at that today. @U2LUY0P8B, did you find a fix for this? clojure-lsp behaves the same way for me on Fulcro projects, though not always. Memory and CPU usage go through the roof while this is going on.


I've not dug into it yet. I think it's complicated for me as I'm on Windows with Ubuntu in wsl2. that's got some known issues on file watchers, and occasionally vs code node workers get into a cpu spin too.


I'm on Windows too, but no WSL.

Jakub Holý (HolyJak)09:11:17

Yes, you must add the config file manually

👍 1
Jakub Holý (HolyJak)16:11:45

How does Calva and clojure-lsp behave wrt. clj-kondo? If I open a fresh clone of [email protected]:holyjak/fulcro-intro-wshop.git and delete the .clj-kondo/com.* files, it seems those configs get imported automatically (which is nice!) and kondo is able to lint the files using info from these even though I do not have .clj-kondo/config.edn How is that possible? As an author, what should I do? Should I include .clj-kondo/config.edn and the imported configs in the git repo? Or is it unnecessary since it works anyway (does it for everybody?)? Thank you!


it's recommended that you commit everything inside .clj-kondo besides .clj-kondo/.cache


the same for .lsp


kondo will copy automatically those configs because clojure-lsp pass a flag telling to do it, but even so, you need to add to your .clj-kondo/config.ednsomething like

{:config-paths [""]}
to lint those extra configs copied previously

Jakub Holý (HolyJak)16:11:35

That is what I thought but somehow it seems to work for me without that.


maybe you have other .clj-kondo config somewhere? like ~/.config/clj-kondo/config.edn or something

Jakub Holý (HolyJak)16:11:41

Indeed, I do. Thank you!

👍 1

Here’s a summary of my first two weeks trying to bring Parinfer to Calva. Enjoy! And please retweet. ❤️

🙏 1

is there a way to get go to definition/docstrings/etc. working for vars defined via macros?


if it matters, I'm using shadow-cljs and in a CLJS context


oh, it suddenly started working