Skip to content
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

Allow starting the sideloader for the tooling session #3039

Merged
merged 1 commit into from
Aug 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

* [#3020](https://github.com/clojure-emacs/cider/issues/3020): Fix session linking on Windows, e.g. when jumping into a library on the classpath.
* [#3031](https://github.com/clojure-emacs/cider/pull/3031): Fix `cider-eval-defun-up-to-point` failing to match delimiters correctly in some cases, resulting in reader exceptions.
* [#3039](https://github.com/clojure-emacs/cider/pull/3039): Allow starting the sideloader for the tooling session

## 1.1.1 (2021-05-24)

Expand Down
7 changes: 4 additions & 3 deletions cider-client.el
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,14 @@ Signal an error if it is not supported."
(unless (cider-nrepl-op-supported-p op)
(user-error "`%s' requires the nREPL op \"%s\" (provided by cider-nrepl)" this-command op)))

(defun cider-nrepl-send-request (request callback &optional connection)
(defun cider-nrepl-send-request (request callback &optional connection tooling)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if a more generic session parameter wouldn't be more appropriate here. Technically a connection can have other sessions than the two created by CIDER by default, and this would allow us to interact with them. I guess this will require a small change in nrepl-send-request as well, though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anyways, I can just do this myself down the road. Let's keep your change focused to the problem at hand.

"Send REQUEST and register response handler CALLBACK.
REQUEST is a pair list of the form (\"op\" \"operation\" \"par1-name\"
\"par1\" ... ).
If CONNECTION is provided dispatch to that connection instead of
the current connection. Return the id of the sent message."
(nrepl-send-request request callback (or connection (cider-current-repl 'any 'ensure))))
the current connection. Return the id of the sent message.
If TOOLING is truthy then the tooling session is used."
(nrepl-send-request request callback (or connection (cider-current-repl 'any 'ensure)) tooling))

(defun cider-nrepl-send-sync-request (request &optional connection abort-on-input)
"Send REQUEST to the nREPL server synchronously using CONNECTION.
Expand Down
9 changes: 6 additions & 3 deletions cider-eval.el
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,16 @@ When invoked with a prefix ARG the command doesn't prompt for confirmation."
(when (member "sideloader-lookup" status)
(cider-request:sideloader-provide id type name))))))

(defun cider-request:sideloader-start (&optional connection)
(defun cider-request:sideloader-start (&optional connection tooling)
"Perform the nREPL \"sideloader-start\" op.
If CONNECTION is nil, use `cider-current-repl'."
If CONNECTION is nil, use `cider-current-repl'.
If TOOLING is truthy then the operation is perfomed over the tooling
session, rather than the regular session."
(cider-ensure-op-supported "sideloader-start")
(cider-nrepl-send-request `("op" "sideloader-start")
(cider-sideloader-lookup-handler)
connection))
connection
tooling))

(defun cider-request:sideloader-provide (id type file &optional connection)
"Perform the nREPL \"sideloader-provide\" op for ID, TYPE and FILE.
Expand Down