Skip to content

Commit

Permalink
Allow starting the sideloader for the tooling session
Browse files Browse the repository at this point in the history
CIDER's deferred loading of middleware means that requires can happen during all
kinds of nREPL ops, many of which are performed over the tooling session. To
make this work via the sideloader we need it to be active both on the regular
session and on the tooling session, so provide a flag for starting it in either
session.
  • Loading branch information
plexus committed Aug 31, 2021
1 parent 60d0e54 commit ca6414d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
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)
"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

0 comments on commit ca6414d

Please sign in to comment.