-
-
Notifications
You must be signed in to change notification settings - Fork 645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inject cider REPL dependencies at cider-jack-in #1552
Conversation
@@ -165,6 +165,11 @@ This variable is used by `cider-connect'." | |||
:type 'boolean | |||
:version "0.9.0") | |||
|
|||
(defcustom cider-skip-repl-dependencies-at-jack-in nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why use a negation here? Why not call it cider-inject-dependencies
or something with a default of t
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess to stress the fact that we default to inject. but I am easy, happy to rename.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @expez.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
This should also be in the README and the changelog. In particular the README's installation section will need some updating. |
(defvar cider-repl-dependencies | ||
`((("org.clojure/tools.nrepl" "0.2.12")) | ||
(("cider/cider-nrepl" ,(upcase cider-version))) | ||
("cider.nrepl/cider-middleware")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest we split this var in two: cider-repl-dependencies
and cider-repl-middleware
or something similar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thinking to leave this as is but rather split cider-add-repl-dependencies
into add-middlewares
and add-dependencies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why introduce complexity (var which holds two types of data) when simplification also makes it easier to work with?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @expez. It's confusing right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Me too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, and we should definitely mark these variables as risky-local.
7b56e5f
to
e28d0ad
Compare
@bbatsov changelog and README is done |
"List of Clojure artifacts for starting the REPL. | ||
First item is a list of dependencies where elements are lists of artifact name and version. | ||
Second item is a list of leiningen plugins where elements are lists of artifact name and version. | ||
Third item is a list of nrepl middleware names.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nrepl -> nREPL
Just to be clear, as it's kind of hard to figure out what the code does without tests - this simply passes more params to I think it should also account for |
(concat | ||
(mapconcat | ||
'identity | ||
(seq-map (lambda (dep) (format "-d %s:%s" (car dep) (cadr dep))) dependencies) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seq-map
can be removed by replacing that 'identity
above with this (lambda ...)
.
Same thing for the ones below.
Thanks for working on this Benedek. I agree that the functions that manipulate the parameters need tests. Right now, it's a little hard to guess what they're supposed to do, so a couple of tests for each of them are sure to be helpful in the future. |
@benedekfazekas Btw, just to be clear - this will take precedence over something in |
if you jack in you should see what it generates to start up the repl. if there is additional params (for cljs): code only modifies params so it should be fine. but you are right I deffo need to test it.
I assumed so but noted: need to explicitly test this too. |
the documentation https://github.com/technomancy/leiningen/blob/master/doc/PROFILES.md#declaring-profiles is not decisive. |
Guess you'll have to test it and see what happens. |
e28d0ad
to
93b7b92
Compare
thanks for the review, I think I made all the changes requested. Tested precedence: CLI params win over Postponed syncing with master as master build seems to be broken atm. |
it seems I have the same test failure as master. suppose I still wait until that is fixed on master... |
Actually it seems the fucked up tests are broken. I'm 100% sure that the code I wrote is correct, but the I'm not nearly as sure about the odd logic of the failing 2 tests. I'll likely just delete them... |
@@ -177,6 +182,18 @@ Sub-match 1 must be the project path.") | |||
(defvar cider-host-history nil | |||
"Completion history for connection hosts.") | |||
|
|||
(defvar cider-jack-in-dependencies | |||
'(("org.clojure/tools.nrepl" "0.2.12")) | |||
"Clojure artifacts for starting the REPL. List of dependencies where elements are lists of artifact name and version.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All 3 docstring start in more or less the same manner. This looks like some mistake to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha that was intentional. I guess my semi-conscious attempt to group them. happy to remove the first sentence if you'd like.
93b7b92
to
14ddb78
Compare
"-d org.clojure/tools.nrepl:0.2.12 -d cider/cider-nrepl:0.11.0-SNAPSHOT repl -m cider.nrepl/cider-middleware -s wait"))) | ||
|
||
(ert-deftest cider-inject-jack-in-dependencies-add-refactor-nrepl () | ||
(setq cider-jack-in-lein-plugins (seq-concatenate 'list cider-jack-in-lein-plugins '(("refactor-nrepl" "2.0.0")))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use let
instead of setq
. Those are dynamic variables and you don't want the tests to affect the defaults.
@@ -655,3 +655,17 @@ | |||
(should (equal (cider-project-name "") "-")) | |||
(should (equal (cider-project-name "path/to/project") "project")) | |||
(should (equal (cider-project-name "path/to/project/") "project"))) | |||
|
|||
(ert-deftest cider-inject-jack-in-dependencies () | |||
(should (string= (cider-inject-jack-in-dependencies "repl :headless" "lein") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest stubbing the version and having one test for a snapshot version and one test for a stable version.
14ddb78
to
065973b
Compare
So users don't have to fiddle with profiles.clj and the like, see details in clojure-emacs#1531 Supports both leiningen and boot. Additionally there is a defcustom `cider-inject-dependencies-at-jack-in` to control this functionality (defaults to t); other tools (like clj-refactor) can modify `cider-jack-in-dependencies`, `cider-jack-in-lein-plugins` and `cider-jack-in-nrepl-middlewares` to inject their own dependencies. Fix clojure-emacs#1531, clojure-emacs#1534
065973b
to
2b4cf44
Compare
Inject cider REPL dependencies at cider-jack-in
👍 |
Woot! :) |
Thank you all. This will have a big impact on the usability of cider, I think. |
I hope you are right. As I said on twitter thx for bringing this up. |
So users don't have to fiddle with profiles.clj and the like, see
details in #1531 Supports both leiningen and boot. Additionally there is
a defcustom
cider-skip-repl-dependencies-at-jack-in
to switch thisfunctionality off (defaults to nil); and an extension point
defun (
cider-add-repl-dependencies
) so other tools like clj-refactorcan inject to their own dependencies, middlewares
Fix #1531 and #1534