This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-07-21
Channels
- # babashka (5)
- # beginners (62)
- # biff (22)
- # calva (22)
- # cider (53)
- # clojure (26)
- # clojure-europe (21)
- # clojure-gamedev (32)
- # clojure-norway (2)
- # clojurescript (22)
- # conjure (1)
- # cursive (2)
- # data-science (14)
- # datomic (22)
- # emacs (6)
- # fulcro (1)
- # ghostwheel (2)
- # gratitude (4)
- # hugsql (15)
- # hyperfiddle (26)
- # lsp (1)
- # melbourne (1)
- # off-topic (19)
- # pathom (5)
- # pedestal (4)
- # practicalli (2)
- # rdf (24)
- # releases (2)
- # shadow-cljs (33)
- # squint (31)
- # tools-deps (24)
- # xtdb (9)
is this a clj-kondo problem or calva problem? this is the suppress unused-binding quick fix on a multi-arity function Calva version used: v2.0.381 clojure-lsp version used: 2023.07.01-22.35.41 clj-kondo version used: 2023.06.02-SNAPSHOT
I think it needs to be fixed in clojure-lsp. Ask about it in #CPABC1H61 and see if they agree.
if you can reproduce the problem with clj-kondo only (on the command line) then I'll have a look. also please paste the code as a standalone repro and not only as a movie, then it'll be easier to repro.
oh right, sorry, the smallest code would be this
(defn foo
([p1] (foo p1 "p2"))
#_{:clj-kondo/ignore [:unused-binding]}
([p1 p2] (println p1 "not using p2")))
oh I didn’t know that, I’ll be using that instead then I should post the issue in clj-kondo then?
I sometime use that _unused
“trick” in destructurings, to inform myself about things that exist in the thing I am destructuring, or what the thing is that I am destructuring. Like:
(defn [{:keys [foo bar _baz] :as _thing}]
…)
posted the issue here https://github.com/clj-kondo/clj-kondo/issues/2145
Hi all, one nice thing in the Calva plugin is that upon saving my source file, the unit tests which reference that namespace are automatically run each time I save the source file (and are neatly highlighted by the lsp server as failures in the test file, which greatly speeds up my workflow since I can just hover over a test and see why it failed). However, this seems to only work when I jack-in using a lein
project, and not with deps.edn
. Is there a way to recover this functionality? I'm wondering if I am missing an alias or something, but couldn't find anything in the docs.
@U0ETXRFEW in both cases I am executing Calva: Start a Project REPL and Connect (aka Jack-In)
. The project in question has both project.clj
and deps.edn
configs. When Calva asks for which project type to launch, selecting Leinginen
project type causes the desired behavior (described above), whereas doing the exact same thing but selecting deps.edn
project type causes nothing to happen. It just says "loading REPL" indefinitely and nothing else occurs.
FYI for further clarification, this is the public test repo (it's an exercism exercise): https://github.com/exercism/clojure/tree/main/exercises/practice/collatz-conjecture. Basically, launch the project in vscode with Calva/LSP/etc configured, and try to jack in. The unit tests will auto-load and run on every save when lein is the project type, but nothing at all happens with the deps.edn project type.
I’m guessing that you not only select deps.edn
, but also select the :test
alias? That won’t work, because it doesn’t start an nREPL server for Calva to connect to. Try without selecting that, and I think it should work the same as with the Leiningen project.
Here’s a solution I just did for that exercise, btw:
(defn collatz
[num]
{:pre [(pos-int? num)]}
(loop [n num
steps 0]
(cond
(= 1 n) steps
(even? n) (recur (/ n 2) (inc steps))
:else (recur (inc (* 3 n)) (inc steps)))))
Similar to yours?@U0ETXRFEW I hadn't done it yet, actually 🙂 but yes that looks quite good! I think unselecting the test alias did the trick. Thought I had done that once already, but could've easily been a mistake. Thanks for the assistance!
Do you run any other plugin @U1EPFAJ1J? I don't have that the tests run automatically. I'm running Calva 2.0.381 and VS Code 1.80.1. I'm using kaocha as test runner.