-
Notifications
You must be signed in to change notification settings - Fork 175
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
Add refresh middleware #173
Conversation
Looking into the Travis failure now. |
d1c095b
to
8c5189f
Compare
Sounds legit. |
Okay, the tests were failing because of the hardcoded 1 second timeout in |
I wonder if "refresh" should simply be an op in "ns" middleware. There is also "refresh-all" along other cool stuff in |
There'd be no harm in that once #143 is resolved - but until then I think it's a good idea to keep the
|
I don't quite follow. You don't have an explicit dependency in BTW, to me it feels that
Sounds good. Alternatively, one can already think of a specialized keymap for ns-related manipulation ( C-c C-s in clojure-emacs/cider#692 proposal) and have separate bindings for them. |
Yes, but the op will only work in a project with Regarding the naming: I picked the same names as Let's see what @bbatsov thinks. |
I'm not opposed to this. The current structure is mostly incidental.
Not sure. I think |
Any thoughts from anyone? |
I think both names have merit. As to the structuring of the handlers I feel like the nrepl stuff kind of belongs at the outer edges. Now you'd have to grep through the project to find all the exposed ops and where they are, which I think is annoying. In trying to split (def refactor-nrepl-ops
{"resolve-missing" resolve-missing-reply
"find-debug-fns" find-debug-fns-reply
"find-symbol" find-symbol-reply
"artifact-list" artifact-list-reply
"artifact-versions" artifact-versions-reply
"hotload-dependency" hotload-dependency-reply
"clean-ns" clean-ns-reply
"find-unbound" find-unbound-reply})
(defn wrap-refactor
[handler]
(fn [{:keys [op] :as msg}]
((get refactor-nrepl-ops op handler) msg)))
(set-descriptor!
#'wrap-refactor
{:handles (zipmap (keys refactor-nrepl-ops)
(repeat {:doc "See the refactor-nrepl readme"}))}) From this one file you can start jumping around to look at whatever I just thought I'd throw this out there. The good news is we can change this around as much as we'd like because it doesn't affect the public API. |
@cichli Ping :-) What I'm mostly interested right now is whether you'd like to implement a more low-level version of the this that'd support:
|
@bbatsov Sorry, I've not forgotten about this :-). The first part is easy, but do we want our reloading to have the same features as i.e.
Both are doable but may involve using a couple of private functions in |
That'd be nice to have, although not a hard requirement.
Guess I can live with this. :-) |
9a13f19
to
a3bf9ed
Compare
Okay, I've pushed a new stab at this that uses tools.namespace directly. It works well from my manual testing, but there are a few outstanding issues:
|
Regarding this bit, we could either have a list of namespaces or a tree of directory->namespace. Out of date directories/namespaces would be highlighted in the view of this tree, and the user could mark individual directories or namespaces for reloading/not reloading (the current implementation respects the use of Thoughts? |
Sounds good.
What are the alternatives?
Fine by me.
Sounds amazing! Much better than the UI I had in mind. :-) |
ff46b8a
to
cf53242
Compare
b5ba46b
to
dec3f94
Compare
👍 |
This just delegates to the
eval
op, similar to nREPL's ownload-file
. Unfortunately it's tricky to callrefresh
directly from the middleware since it sets*e
, which doesn't play well with nREPL's binding conveyance. Seeing as howload-file
also sets*e
and*1
I think it's acceptable for this middleware to do it too.The
msg
arg torefresh-code
is unused as of now, but I plan to addafter
/before
options to make the reloaded workflow easier to integrate in CIDER - I'm just not sure how this will work client-side. I guess we can prompt for the namespace-qualified symbols of the functions to call before/after refreshing, or have options for them and encourage people to use.dir-locals.el
to set them on a per-project basis.Fixes #13.