This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-12-07
Channels
- # adventofcode (114)
- # announcements (3)
- # aws (5)
- # babashka (62)
- # beginners (111)
- # calva (4)
- # cider (20)
- # clara (5)
- # clj-kondo (1)
- # cljs-dev (9)
- # clojure (255)
- # clojure-europe (75)
- # clojure-italy (10)
- # clojure-nl (3)
- # clojure-norway (5)
- # clojure-uk (6)
- # clojuredesign-podcast (5)
- # clojurescript (34)
- # community-development (28)
- # conjure (1)
- # cursive (3)
- # data-science (1)
- # datavis (1)
- # datomic (4)
- # figwheel-main (1)
- # fulcro (14)
- # graalvm (1)
- # graphql (8)
- # integrant (4)
- # introduce-yourself (2)
- # jobs (2)
- # juxt (4)
- # kaocha (2)
- # malli (6)
- # membrane-term (53)
- # mount (2)
- # nextjournal (2)
- # off-topic (27)
- # pathom (11)
- # polylith (3)
- # portal (11)
- # reagent (4)
- # reitit (4)
- # remote-jobs (1)
- # reveal (14)
- # shadow-cljs (22)
- # tools-deps (24)
- # vim (6)
- # xtdb (19)
REPL started from a deps.edn file containing this definition for :jvm-opts
doesn't seem to pickup the options - is this :cider/nrepl
alias the correct way to pass them?
...
:aliases
{:cider/nrepl
{:jvm-opts ["-Djdk.attach.allowAttachSelf=true"
...
From what I remember from a GH issue, :cider/nrepl
is internal / not an API; instead you should define your own alias and make cider use it via a related defcustom
Thanks, found cider-clojure-cli-aliases
here: https://docs.cider.mx/cider/basics/up_and_running.html#clojure-cli-options
Also found this which suggests another approach: https://clojureverse.org/t/how-to-setup-deps-edn-project-with-cider/6375/6
I'm struggling to set it to proper value via customizer-variable
- what is the proper syntax?
I tried dev
, dev:
, '("dev")
, etc. but nothing seems to work
I know of a codebase that uses this (cider-clojure-cli-global-options . "-A:dev:test")
(note it's a different defcustom)
Here I've found a newer information: https://practical.li/spacemacs/clojure-projects/project-configuration.html
Ended up with this in .dir-locals.el
:
((clojure-mode . ((cider-preferred-build-tool . clojure-cli)
(cider-clojure-cli-aliases . ":dev"))))
I couldn't make it work via customize-variable
guiYou don't need that leading semi colon. Also, you only need to specify the preferred build tool if there are multiple tooling files (shadow-cljs.edn or project.clj files at the root as well)
Not using a leading colon is confusing, as it’s not the name of the alias. I always include the colon so it’s consistent with the normal use. It seems cider adds an extra colon after the -M flag for some reason, but it still works
When I use an alias, for example ":dev:test"
, as the cider-clojure-cli-aliases
value, then in the command line that Cider generates when calling cider-jack-in-clj, that command ends with
-M::dev:test:cider-nrepl
I assume it works because the missing alias, the first colon by itself :
, doesnt match anything, so is just ignored by the clojure command line program
I noticed this when I was editing the command before executing, using C-u
(or SPC-u in spacemacs)
On my project at work I get the same result. This is the command from the buffer window after running cider-jack-in-cljs with a .dir-locals.el set to include ":env/develop:env/test"
Starting new CIDER session ...
[nREPL] Starting server via /usr/local/bin/clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version "0.9.0-beta5"} cider/cider-nrepl {:mvn/version "0.27.2"}} :aliases {:cider/nrepl {:main-opts ["-m" "nrepl.cmdline" "--middleware" "[cider.nrepl/cider-middleware]"]}}}' -M::env/develop:env/test:cider/nrepl
[nREPL] server started on 34825
[nREPL] Establishing direct connection to localhost:34825 ...
[nREPL] Direct connection to localhost:34825 established
1
i see. the string functions could use a little cleanup then. It does some trimming and needs to be updated to allow for a leading :
on the cli aliases
I want to add cemerick.pomegranate
as a dev dependency (only for me) on a tools.deps
project. What is the best way to go about it?
throw that dep in an alias in your ~/.clojure/deps.edn and add that when you jack in. you can manually edit the jack-in string with a prefix arg, or use dir locals in that project
((nil
(cider-clojure-cli-aliases . "pomegranate")))
or whatever you name the alias. that requires adding the dir-local to the repo, not sure if that’s already taken. another option is just to copy the startup command from the repl buffer at the top and then start it yourself on the command line with whatever aliases you want. This is the most straightforward way i think