This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-06-13
Channels
- # announcements (4)
- # babashka (72)
- # beginners (86)
- # biff (24)
- # boot (1)
- # calva (71)
- # cherry (1)
- # cider (8)
- # clerk (7)
- # clj-kondo (23)
- # clojure (78)
- # clojure-art (3)
- # clojure-austin (2)
- # clojure-europe (18)
- # clojure-hamburg (6)
- # clojure-nl (1)
- # clojure-norway (17)
- # clojure-uk (2)
- # clojuredesign-podcast (21)
- # clojurescript (17)
- # conjure (1)
- # cursive (18)
- # datahike (7)
- # datomic (7)
- # emacs (1)
- # etaoin (5)
- # events (1)
- # figwheel-main (4)
- # graalvm (37)
- # graphql (1)
- # humbleui (12)
- # hyperfiddle (10)
- # introduce-yourself (1)
- # jobs-discuss (7)
- # kaocha (1)
- # malli (5)
- # off-topic (12)
- # pathom (12)
- # practicalli (1)
- # reitit (11)
- # releases (2)
- # shadow-cljs (45)
- # tools-build (33)
- # wasm (18)
IIUC, launching a repl with "start a project repl and connect aka jack-in" and choosing "deps.edn + shadow-cljs" will transparently activate the :shadow-cljs deps alias in the userland project if such an alias exists, is this correct?
My real underlying question is that I receive this popup window [screenshot], which brought me to my project's deps.edn, but I did not ask for calva to activate this alias, this alias is part of our CICD pipeline
:shadow-cljs {:extra-deps {thheller/shadow-cljs {:mvn/version "2.22.10"}}
:main-opts ["-m" "shadow.cljs.devtools.cli"]
:jvm-opts ["-Xss2m"]}
Question back to you: Was it the pop-up that led you to think the alias was auto-selected?
I tried to figure out what was happening as I couldn't explain the prompt
It isn’t auto-selected. That popup is to make you select it only if you know it has the potential to work. Aliases with main-options generally do not start an nrepl server, so it is generally not a good idea to include them, because the main options will make Calva not add its main options for startin the server.
Ok i guess the answer is yes, the popover did make me think that the alias was selected
I am still confused though, i dont understand "it work"
But it is so far much better than all the support spent helping people who were selecting these aliases.
The popup appears at the same time as the alias list. Maybe if we presented the popup first and waited for it to be dismissed before displaying the aliases menu, it would be clearer.
Where did the string ":shadow-cljs" come from in that prompt
Calva analysed my deps.edn to search for aliases that specify :main-opts ?
For my understanding, what is the benefit of doing that?
From above: > it is so far much better than all the support spent helping people who were selecting these aliases.
What are the technical benefits, i dont understand what calva could possibly want to do
The benefit is avoiding the problem with selecting a main-opts alias that do not start an nrepl server. Selecting such an alias will make the repl connection fail.
but i didn't select the :shadow-cljs alias, so why would calva even look at it
The main reason for this is to present you a menu with the available aliases you might want to launch with.
Ok, i see the :main-opts prompt is concurrent with the alias list. yet still I did not select :shadow-cljs
As can be seen on the screenshot the list and the prompt are presented at the same time. The prompt is there to help you avoid selecting the :shadow-cljs
alias, which in your case has main-opts (or at least Calva thinks it has).
Can the prompt be moved to right after I select the alias, so that if I select :shadow-cljs it warns me?
What we can do (I think), is present some info below the shadow-cljs alias with the info that it has main opts and could cause trouble. Instead of the prompt…
you mean in the deps alias picklist?
ok, sure
anyway i understand now - thank you
i can also help you tweak the copy, do you want me to try to write an improved error?
It isn’t an error 😃 But yes, that would be great! I don’t think that if we add the info to the menu instead, (which I am starting to think we should) we won’t have much space. So something really short to go there would be great. And as a backup some alternative text for the info-popup.
from the existing scrollbar behavior i think i can infer that you can add a panel for the docstring
just truncate the :main-opts, just by putting some of it in the row is enough for someone to connect that it is important in the context of the label
Here is my context-free description of the issue if it helps: "Calva uses deps.edn :main-opts run a nREPL server in your project classpath. If the deps.edn alias you select already specifies :main-opts, Calva will not override it. In this case, your alias's main-opts must be sure to run an nREPL server for Calva to connect to."
Alternatively, you could just launch the thing and alert the notification concurrently with running the process in the case that project-specified main-opts are present
"Calva uses" -> "Calva injects"
"Calva injects :main-opts into your project in order to run the nREPL server, unless :main-opts are already specified by the selected alias, in which case the project must run an nREPL server for the Calva REPL to connect to."
I don't think it actually "injects :main-opts" -- What Calva does is supply "main opts", i.e., -M -m ...
to start nREPL unless one of the aliases you selected already contains :main-opts
The other thing to be cautious about is that "last one wins" with :main-opts
so the actual order of the selected aliases is also important (and users cannot control that -- it's just whatever order Calva displays the aliases).
is there a difference between injecting:main-opts into my deps.edn vs supplying -M -m at the CLI
"injecting :main-opts" doesn't mean anything -- it's only valid inside an alias.
update-in deps [:aliases selected] assoc :main-opts calva-stuff
It is not doing that.
That's Leiningen thinking.
ok, I rest
I think my preference would be for the alias picklist to visually identify aliases that have :main-opts
(but there's no need to show the contents of that, just that there are :main-opts
).
The wording on the popup could definitely be expanded and clarified.
I have a build now where the pop-up warning/info is removed and replaced with information together with the :main-opts
alias in the list instead. Would be wonderful with some help testing it. Here’s a VSIX: https://output.circle-artifacts.com/output/job/ff0a0567-9972-4e4a-9751-9a46c95b86d0/artifacts/0/tmp/artifacts/calva-2.0.370-2223-main-opts-info-96106ab3.vsix
i’ll try out the vsix tomorrow if i can figure out how
1. Download it (rename it from .zip
to .vsix
if necessary)
2. From the top meatballs menu of the VS Code Extensions pane, select Install from VSIX.
While working on this I noticed that the API does allow for attaching a callback to the items when they are selected. Mentioning this because yesterday I said there wasn’t such an API. Didn’t need it now, but might come in handy, who knows.
Love it!
That project expects clojure -M:test
because I haven't updated it yet...
Overall, that is a bit of a problem with Calva and a lot of projects out there: the Cognitect test-runner
tells you to put :main-opts
in your :test
alias but then you can't jack-in with tests on the classpath.
I'm not sure what the solution is (within Calva). Obviously, the solution within the projects is to not have :main-opts
in the :test
alias 🙂
This suggestion by @U02EMBDU2JU might be the solution to that, @U04V70XH6: https://github.com/BetterThanTomorrow/calva/issues/1682
You mean I misunderstood it, and it isn’t a solution to the problem, or that you are impressed that I understood it to that extent? 😃
I'm impressed you understood it correctly since after a year I had a hard time understanding my own statement... :thinking_face:
To me if the question is posed “do what CIDER does?“, I quickly and enthusiastically default to “hell YES!” 😃
As I just noted on that ticket, this would break my entire workflow in almost every project.
In my shadow-cljs projects I have an issue with completions for js, meaning I don't get any. Writing js/ just tells me 'invalid symbol'. Now I don't know if this should give me completions or not. Could anyone give me a hint?
I have a build now where the pop-up warning/info is removed and replaced with information together with the :main-opts
alias in the list instead. Would be wonderful with some help testing it. Here’s a VSIX: https://output.circle-artifacts.com/output/job/ff0a0567-9972-4e4a-9751-9a46c95b86d0/artifacts/0/tmp/artifacts/calva-2.0.370-2223-main-opts-info-96106ab3.vsix