Fork me on GitHub
#babashka
<
2020-03-26
>
rymndhng04:03:46

> hello! babashka looks really interesting (I’m interestedin porting a bash script). I noticed the README mentions that there’s editor integration. > > I’m using inf-clojure-minor-mode, however I don’t seem to have auto completion working (it complains about lumo.repl for some reason).

mauricio.szabo13:03:16

Chlorine (for atom) does auto-complete, load-file, and goto var definition 🙂

solf06:03:03

Hello @rymndhng. I've managed to have inf-clojure work with babashka using this config:

(use-package inf-clojure
  :ensure t
  :config
  (setq-default inf-clojure-repl-type 'clojure)
  (setq inf-clojure-completion-form
	"(clojure.core/let [collect (fn [x y] (clojure.core/map
                                   (clojure.core/comp str first)
                                   (x y))) 
			   refers (collect clojure.core/ns-map *ns*)
			   from-ns (->> (clojure.core/ns-aliases *ns*) 
					(clojure.core/mapcat
					 (fn [[k v]] 
					     (clojure.core/map (fn [x] (str k \"/\" x))
							       (collect clojure.core/ns-publics v)))))] 
		  (clojure.core/->> refers 
				    (concat from-ns) 
				    (clojure.core/filter
				     (fn [x] (re-find #\"%s\" x)))
				    (clojure.core/sort)
				    ))")

  (setq inf-clojure-arglists-form
	"(:arglists (meta (clojure.core/resolve (quote %s))))"))

solf07:03:10

However, in the end I didn't keep using it. For me it was too limiting compared to cider. So now I just have this :bb alias in my ~/.clojure/deps.edn to emulate bb built-in libs, and I dev bb scripts as if they were clojure ones.

:aliases {
           :bb {:extra-deps
                {org.clojure/core.async {:mvn/version "1.0.567"}
                 org.clojure/tools.cli {:mvn/version "0.4.2"}
                 org.clojure/data.csv {:mvn/version "1.0.0"}
                 cheshire {:mvn/version "5.10.0"}}}
           :test {:extra-paths ["test"]}
           }

rymndhng07:03:08

@dromar56 thanks for the tips. I have also found it a bit limiting compared to a cider environment 😉 that said, I’ve really enjoyed the fast startup times for little CLI scripts — for that kind of work I feel comfortable enough to not rely on autocompletion 😁

solf07:03:45

The config I linked should fix eldoc (you can see the arguments of the function at point in the minibuffer) and auto-completion, so at least you'll have that :)

borkdude07:03:20

@rymndhng @dromar56 Im working on an nREPL server. Please check out the latest binaries from #babashka_circleci_builds from the nrepl-server branch. Still no completion, but I do want to get that in

clj 8
thanks3 4
borkdude07:03:46

Testing feedback is welcome in the Github issue