This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # atom-editor (2)
- # babashka (39)
- # beginners (123)
- # calva (90)
- # cider (57)
- # clojure (102)
- # clojure-australia (13)
- # clojure-europe (38)
- # clojure-france (3)
- # clojure-italy (13)
- # clojure-nl (7)
- # clojure-norway (2)
- # clojure-seattle (1)
- # clojure-uk (22)
- # clojurescript (28)
- # conjure (20)
- # cursive (2)
- # datascript (1)
- # datomic (20)
- # depstar (23)
- # emacs (1)
- # events (2)
- # graphql (12)
- # honeysql (4)
- # jobs (2)
- # kaocha (2)
- # malli (14)
- # music (2)
- # off-topic (103)
- # pathom (8)
- # polylith (7)
- # quil (3)
- # reagent (7)
- # reitit (2)
- # remote-jobs (1)
- # shadow-cljs (55)
- # slack-help (4)
- # spacemacs (29)
- # xtdb (16)
Hello guys, can someone help me setting up Intellij + cursive with babashka? I can't get it to recognise dependencies. Do I have to create a dummy lein project with babashka as a dependency to make it work?
@beltramo.ale If you want auto-completion things and have Cursive analyze the dependencies then probably it's enough to add a deps.edn with the deps you are using in your script(s)
Thanks, I'll try that! How does it play with pods? I would like to use lispyclouds/docker but my guess is that
(require '[pod.lispyclouds.docker :as docker]) will never be accepted by cursive because the dependency from clojure should be:
[clj-docker-client.core :as docker] .
@beltramo.ale If you use the babashka nREPL server you can get auto-completions for this, but pods aren't dependencies that can easily be statically analyzed
Right, I see.. Is there a better IDE for developing babashka scripts? What do you guys use then?
I'm trying to run an nrepl (`bb --nrepl-server 1667`) with cider in emacs. This seems to work fine, usually, but this morning the repl just dies silently when I try to eval a buffer. I'm sure it's just an error in my code, but I don't get any error messages (either on the bb side, nor on the cider side). Is there a way to see what's going wrong? I tried
--verbose with no result.
Ah, I see what's happening. I'm trying to eval the whole buffer, so it's running the code and spitting out a usage message (i.e., because I don't have the required args). I didn't spot that amidst the "closed unexpectedly" message from cider.
Nah, just exit normally, with a usage. Cuz that's what I asked it to do. I rewrote the script to have a -main function and then did something like this
So now I can eval the whole buffer and use the functions, but the script itself doesn't run.
(when (= *file* (System/getProperty "babashka.file")) (-main))
@beltramo.ale Developing bb scripts should not require a lot from an editor. Just paredit + syntax highlighting maybe. Bb scripts start so fast that you usually barely need a REPL, although many people do prefer one.
If IntelliJ / Cursive gives you trouble for developing a script, maybe discuss it with the author to add better support for it.
Here's the commands I made to spawn and connect to a babashka repl, from emacs/CIDER: https://gist.github.com/llacom/f391f41cbf4de91739b52bf8bb1a6d54
I meant to improve them before sharing, but never took the time. It works for me at least :man-shrugging:
Yeah I just saw https://github.com/cursive-ide/cursive/issues/2452 the issue is that since it can't recognise imports just set everything as errors and it's unusable. I'm trying calva and it seems to do the trick. Thanks for the help, and the amazing work behind Babashka!
Calva uses both clojure-lsp and nrepl for the completions. And clojure-lsp also makes a lot of other features available. You can probably get a lot of the similar experience in Emacs using CIDER + lsp-mode. But with Calva it is out-of-the-box. Not possible to opt-out, even . 😃
“Oh no I can’t opt out of this very helpful feature”. Now that’s the kind of problems I want.
I think it's good to have opinions (defaults), but not to be stubborn: always give people a way out, unless your tool can't function without it
It might not be the right place, but is there any magic trick to have pprint with cider using
bb --nrepl-server ?
@neo2551 There is an open PR for this in babashka.nrepl which is currently stalled. Maybe you could help out by reading the issue and seeing what remains to be done.
as in, the only remaining one? I can’t push to his branch and it would be a shame to have to open a new PR and lose the review history just to fix that one thing. Can you push on his branch?
if you remember, I only saw babashka yesterday, so getting set up with sci and everything might take me some time
@U01KUQRDMLG I merged to the pprint branch now. Feel free to continue with a new PR on that branch
I made a few comments in the old PR which have not been processed yet. Notable the one about
So, I finished my first moderately-sized https://github.com/eamonnsullivan/backup-scripts/blob/master/src/eamonnsullivan/backup.clj. It will probably make any competent babashka user's eyes bleed, is basically a translation of a bash script, but it was fun to do. I originally had more actual Clojure (as opposed to calls to
clojure.java.shell) in it, but I stripped that back after I basically wiped a PC while trying to test it. 😮 (The problem turned out to be an incorrect exclude to rsync, so I was copying over a symlink to
/ and when I tried to remove the directory using pure and naive Clojure, it went down that rabbit hole.) I am definitely hooked!