This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-11-17
Channels
- # aleph (4)
- # announcements (2)
- # babashka (74)
- # beginners (136)
- # calva (72)
- # clj-commons (32)
- # clj-kondo (7)
- # cljs-dev (3)
- # clojure (117)
- # clojure-europe (38)
- # clojure-nl (3)
- # clojure-norway (1)
- # clojure-uk (4)
- # clojurescript (19)
- # conjure (38)
- # core-logic (2)
- # cursive (10)
- # datalevin (1)
- # datalog (1)
- # datomic (6)
- # events (2)
- # fulcro (16)
- # google-cloud (5)
- # graphql (10)
- # gratitude (3)
- # hugsql (3)
- # luminus (5)
- # membrane-term (12)
- # missionary (2)
- # nextjournal (5)
- # off-topic (3)
- # pedestal (2)
- # polylith (7)
- # portal (3)
- # re-frame (6)
- # reagent (26)
- # reclojure (8)
- # releases (3)
- # reveal (5)
- # shadow-cljs (14)
- # spacemacs (20)
- # sql (3)
- # tools-build (3)
- # web-security (9)
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
(:require
[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.
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.
I had forgotten about the “Select CLJS Build Connection” command. 😃 Is it a Figwheel Main project?
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)]
(try
(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)))))
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.
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.
Right back at you for the repro. Can you add some info to it about what a merged build is?
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 https://github.com/fulcrologic/fulcro-rad-demo)
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, https://github.com/clj-kondo/clj-kondo/blob/master/doc/config.md#introduction 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!in the meantime, I'll see what I can figure out from https://clojurians.slack.com/archives/CBE668G4R/p1636202877297800
Hello! It makes sense to start here with Calva. Have a look in this thread and see if you find some useful info. https://clojurians.slack.com/archives/CBE668G4R/p1636202877297800
@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
See https://github.com/clj-kondo/clj-kondo/blob/master/doc/config.md#exporting-and-importing-configuration Perhaps @U0522TWDA can help you out here.
thanks @U04V15CAJ.
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(LazySeq.java:42)
at clojure.lang.LazySeq.seq(LazySeq.java:51)
at clojure.lang.RT.seq(RT.java:535)
at clojure.core$seq__5402.invokeStatic(core.clj:137)
at clojure.core$map$fn__5866.invoke(core.clj:2746)
at clojure.lang.LazySeq.sval(LazySeq.java:42)
at clojure.lang.LazySeq.seq(LazySeq.java:51)
at clojure.lang.RT.seq(RT.java:535)
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(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint$$Lambda$36/00000000E861ECB0.apply(Unknown Source)
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.notify(GenericEndpoint.java:152)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleNotification(RemoteEndpoint.java:220)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:187)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:847)
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
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!
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 🙂
This might be helpful to you, @U2LUY0P8B: https://calva.io/clojure-lsp/#troubleshooting
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.
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
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.edn
something like
{:config-paths ["com.foo.bar/baz"]}
to lint those extra configs copied previouslyThat 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
Here’s a summary of my first two weeks trying to bring Parinfer to Calva. https://twitter.com/pappapez/status/1461018167002734592 Enjoy! And please retweet. ❤️