cider
cider copied to clipboard
Draft: specifying default connection params
Context: https://clojurians.slack.com/archives/C0617A8PQ/p1687640686417379
As discussed on Slack, a naive clj-only implementation of a feature which allows the user to skip cider-connect
prompts asking for the hostname and port.
The intended usage here is to set cider-default-connect-params
explicitly per project as a dir-local variable, which is why it's a defvar-local
instead of defcustom
.
Eg. I have a project which specifies in its deps.edn
{:aliases {:dev
:main-opts ["-m" "nrepl.cmdline" "--port" "2171" ,,,],,,},,,}
so running clj -M:dev
in an external terminal always starts a Cider nrepl server on the port 2171.
Then in the project's .dir-locals.el
:
((clojure-mode
. ((cider-connect-default-params . (:host "localhost" :port 2171)))))
Result: M-x cider-connect
on any clj buffer within that project skips the prompts entirely, saving the friction of a couple of RET RET
keypresses on every connect. Which can be quite frequent when investigating project crashes (or hacking on Cider itself)
Before submitting the PR make sure the following things have been done (and denote this by checking the relevant checkboxes):
- [ ] The commits are consistent with our contribution guidelines
- [ ] You've added tests (if possible) to cover your change(s)
- [ ] All tests are passing (
eldev test
) - [ ] All code passes the linter (
eldev lint
) which is based onelisp-lint
and includes-
byte-compilation,
checkdoc
, check-declare, packaging metadata, indentation, and trailing whitespace checks.
-
byte-compilation,
- [ ] You've updated the changelog (if adding/changing user-visible functionality)
- [ ] You've updated the user manual (if adding/changing user-visible functionality)