-
-
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
Clojure CLI tools - optional jack-in dependencies and params #2922
Comments
From the previous discussion, I did consider the implications of merging the global opts, params and even dependencies for Clojure CLI tools. However, this always seemed to lead to lots of potential conflicts with provided global-ops and the Cider auto-injected configuration. As the command line is very flexible for Clojure CLI tools, it would seem that some kind of parsing would be required of any supplied global-opts to ensure a main namespace was not already included. The parsing would need to check the project deps.edn file as well as the user level config in I am assuming the new |
@bbatsov would adding a new defcustom If so, I will create a pull request with this change. |
at this point i wonder if the best option might be a var that the user can set which contains the whole jack in string? maybe its just far easier to have a self-contained "don't resolve anything, add middleware, whatever. just start a process with this and connect to it" type var. ;; .dir-locals.el
((nil . ((cider-full-jack-in-command . "clojure -X whatever")) |
So the concept of adding a var seems agreed, just different scope of detail for that var. In the slack discussion you mention a single string called https://github.com/clojure-emacs/cider/blob/master/cider.el#L1279-L1285 is where the string is built up and here the string is just passed into nrepl-start-server-process https://github.com/clojure-emacs/cider/blob/master/cider.el#L1007-L1011 I tried wrapping an
That code generates
So I probably have the :jack-in-cmd cider-full-jack-in-command wrong...
seems thread-first doesnt put params where I want it to be Actually, looking through some of the other code, editing the Although I generally understand what the TODO: Read the following article to see if it helps with a solution https://metaredux.com/posts/2019/11/02/hard-cider-understanding-the-jack-in-process.html |
I am no longer using cider-jack-in with Clojure CLI tools so will close this issue EDIT: use |
Evolving the Cider support for Clojure CLI tools by providing a means to switch off the auto-injected dependencies.
Using Clojure CLI tools, the auto-injected dependencies and parameters can be replaced by a single alias (or combined aliases), simplifying the command line. This also allows for greater flexibility in how cider is run, whilst still providing the highly convenient jack-in experience.
Related to #2916
Use cases
Additional command line options
Add an alias to include extra paths and/or libraries to the Clojure repl (eg.
:env/test
which adds the:extra-paths ["test"]
value so that the Cider test runner can find the unit test code in a project (without it having to be added to the main paths and ending up with test code in production).The latest release of Cider already allows such an alias to be injected correctly along with the standard Clojure libraries and parameters
Custom command line options
Use custom command line options that replace the auto-injected dependencies and params
Set
cider-clojure-cli-global-options
(EDIT: this variable has been replaced bycider-clojure-cli-aliases
) value via.dir-locals.el
and use only that value as an argument to theclojure
commandThe
cider-clojure-cli-global-options
would provide an alias that included the relevant nrepl, nrepl-refator & cider-nrepl libraries.Using the universal argument, this would also present a simplified command line, avoiding the need to delete the injected cider options
Suggested Code change
Update the
cider-inject-jack-in-dependencies
function to include a check of the new variable calledcider-clojure-cli-jack-in-options
, which should be set to true by default to retain the current behaviour of Cider.Create a defcustom called
cider-clojure-cli-jack-in-options
and set to true by default.If
cider-clojure-cli-jack-in-options
is set tonil
then only the value ofcider-clojure-cli-global-options
is used with theclojure
commandCode change from line 635 of
cider.el
A video of my experiments around this issue is here: https://youtu.be/XuquYgOSOnc?t=6879 (skipped to the conclusion as its about 2 hrs long)
@bbatsov if this approach seems sensible, I'll raise a PR with this change. Happy to discuss further if you wish.
The text was updated successfully, but these errors were encountered: