Q from the Discljord server: rgdelato (he/they): Hello! By chance, does anyone have tips on getting Calva and Parinfer to play nice together? As best as I can tell, Calva removed its built-in Parinfer integration, so I installed the Parinfer extension separately, but it doesn't seem to be doing anything and I'm not sure what I'm doing wrong... rgdelato (he/they): Also, I'm on a pretty-close-to-clean install of VSCodium so they shouldn't be conflicting with anything else
There used to be a separate extension for Parinfer, but I think it’s not maintained and it may have stopped working. It should work fine with Calva, though, if it works.
Would they need to turn things off in Calva to avoid interfering with Parinfer?
@rgdelato is on Slack but not in this channel...
(and not very active on Slack apparently)
> Would they need to turn things off in Calva to avoid interfering with Parinfer? I don’t think so. But it was many years ago I tried it. Maybe they disagree about indenting…
I would imagine Calva's formatting/indenting might conflict?
Calva’s formatting is largely on-demand. So it shouldn’t conflict. But the indenting could. I don’t know if Parinfer provides indenting. Definition of indenting here is the behaviour when hitting enter for a new line and where the cursor ends up on that line. Everything else is formatting.
Thank you both for the help! (It's me, I'm in the correct Slack channel now)
And yes, it looks like the Parinfer extension that's published on the Open VSX registry is broken
Not saying this will actually happen, but let's say I was interested in contributing a fix for using Parinfer in VSCode---would you be happier with me working to contribute something to Calva, or working on a completely separate Parinfer extension? (I am aware that this is a difficult problem.)
Are you aware how difficult? 😃
@rgdelato Of course I actually mean: Hi! Happy to meet!
I think that for Parinfer to work best with Calva it should be as an integral part of Calva’s structural editor. I would be most happy to help with figuring out how to integrate and how it should behave. For the latter I do have a design in mind (the one I spent several months failing to get to work fully). So if you do find you want to do it, please holler my way.
Are you aware how difficult? 😃I don't REALLY know how difficult, but I helped out on the Atom version of Parinfer many years ago, and at least at that time, Shaun seemed to think proper VSCode support was kind of an unsolvable problem without more support from the VSCode side of things due to how edits were handled, though that was a long time ago. Also, hello! Happy to meet you as well! 👋
Unfortunately, VS Code’s API, resulting from their Monaco editor’s deliberate ‘guarantees’ (drawing ‘lessons’ from Atom’s vulnerability to conflicting extension behaviour), makes it fundamentally impossible to get Parinfer working well: it does not (and probably never will) support synchronously preprocessing user input before that is applied. The old, unmaintained, Parinfer extension works with Calva to some degree anyway (if you can bear occasional race conditions) when you turn off Calva’s “strict mode”, but then smart indentation no longer works either, which is painful (from memory; here I probably miss a relevant detail.) Earlier this year I even experimented with an (vibe coded, not published) extension that renders CodeMirror inside a VS Code web view … and indeed got that to work with proper Parinfer+smart indent. But it is an unavoidably clunky experience to say the least (piggying back to the Calva editor, which then needs to be visible for it to work, for REPL operations and LSP integration) with the lack of native rendering engine integration making the font rendering look terrible (might be specific to Linux/Wayland). I now can’t remember whether I considered forking the Parinfer extension itself to also take care of smart indentation in such a way that it would not conflict with Calva (with strict mode and formatting turned off). That might still be an interesting experiment to explore, even with race conditions.
@pez I tagged you on Discord but I'm not sure how active you are there?
I hate Discord. 😃 Only ever check there around the Conj time. This year I even had to, because that was the only way to use the conference app.
Yeah, Discord is very low on my list of chat app choices (and Discljord in particular is... weird).
Anyways, if you have any suggestions for that user, I'm happy to relay them back to Discord for you!
Lovely service! ❤️
Hi, hope you are all well. I have been learning Clojure using the Programming Clojure 4th edition. I am in the Project Tooling chapter and am trying to run tests. I am trying to run tests using Calva but Calva seems to not be able to see tests in a project. I found the page on calva docs that shows how to add "test" folder to :extra-paths when using deps.edn. I have also tried adding the "test" folder in the paths section but calva doesn't seem to be able to see the tests and run them. What could I be doing wrong?
Here is my deps.edn file
{:paths ["src" "test"]
:deps
{org.clojure/clojure {:mvn/version "1.12.6"}
org.clojure/data.json {:mvn/version "2.5.1"}
org.clojure/test.check {:mvn/version "1.1.3"}}
:aliases
{:dev {:extra-paths ["test"]}
:test {:extra-paths ["test"]
:extra-deps {org.clojure/test.check {:mvn/version "1.1.3"}
io.github.cognitect-labs/test-runner {:git/tag "v0.5.1", :git/sha "dfb30dd"}}
:main-opts ["-m" "cognitect.test-runner"]
:exec-fn cognitect.test-runner.api/test}}}
Here is my simple test file core_test.clj in test/ke/co/thirdline/jaribu folder
(ns ke.co.thirdline.jaribu.core-test
(:require [clojure.test :refer [deftest is]]
[ke.co.thirdline.jaribu.core :as core]))
(deftest test-within?
(doseq [x (range 0 10)]
(is (true? (core/within? 0 10 x))))
(is (false? (core/within? 0 10 -1)))
(is (false? (core/within? 0 10 11)))
(is (true? (core/within? 0 10 8))))
Here is my simple main file that has the function that's being tested core.clj in src/ke/co/thirdline/jaribu folder
(ns ke.co.thirdline.jaribu.core)
(defn within? [min max val]
(<= min val max))
Thank you.Hi! Checking, have you evaluated the test namespace?
Thank you. After evaluating the test namespace and then running the test in Calva it has worked. I didn't know I needed to load the test namespace. Thank you so much for your help.gratitude-thank-you
You’re welcome! Seems we are missing that info in the docs?
I wonder what people do to make this convenient… I am seldom using the Calva test runner myself.
What test runner do you normally use?
I mostly work with ClojureScript and shadow-cljs so use its test-runner as a watcher. And I also run tests directly from the repl, and using custom repl commands. I think it is much about personal preferences.