Unify cider-jack-in entry points around shared helpers#3883
Merged
Conversation
cider-jack-in-cljs and cider-jack-in-clj&cljs were open-coding the param-update pipeline and calling nrepl-start-server-process directly, while only cider-jack-in-clj went through cider--start-nrepl-server. This left cider-jack-in-clj missing the originating-buffer preservation that the cljs paths bothered to add by hand, so its connect callback could fire in whatever buffer the user had switched to in the meantime. Move the buffer preservation into cider--start-nrepl-server so all callers get it, and funnel the cljs entry points through that helper plus cider--update-params. Extract the cljs-deps dynamic-let into a small cider--with-cljs-jack-in-deps macro shared by both cljs paths.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The three jack-in entry points had drifted apart.
cider-jack-in-cljwent throughcider--start-nrepl-server, butcider-jack-in-cljsandcider-jack-in-clj&cljsopen-coded the param-update threading and callednrepl-start-server-processdirectly. Both cljs paths bothered to capture the originating buffer and re-enter it in the on-port callback; the clj path didn't, so itscider-connect-sibling-cljcould fire in whatever buffer the user had switched to in the meantime.This PR pulls the originating-buffer preservation into
cider--start-nrepl-serverso every caller gets it, then routes the cljs entry points through that helper andcider--update-params. The cljs-deps dynamic-let preamble shared betweencider-jack-in-cljsandcider-jack-in-clj&cljsbecomes a smallcider--with-cljs-jack-in-depsmacro.Net result: the clj entry point's missing buffer preservation is fixed, ~30 lines of duplication go away, and the three commands now follow the same shape.
This is the first step of a broader cleanup of jack-in. Follow-ups planned: a project-type registry to collapse the five parallel
pcasedispatches into one, and a documentation pass on the TRAMP story.