Repository navigation
Add a command that adds the require or import a symbol needs - #4217
Merged
Merged
Conversation
bbatsov
force-pushed
the
ns-add-missing
branch
3 times, most recently
from
October 22, 2026 16:44
6765422 to
1f0aa9e
Compare
Merged
clj-refactor's cljr-add-missing-libspec needs refactor-nrepl, and cider-nrepl's new cider/resolve-missing op makes that unnecessary. cider-ns-add-missing asks it what could provide the symbol at point and adds the pick: a refer for foo, an alias for alias/foo, a plain require for some.ns/foo, and an import for a class, along with a require of the namespace defining a deftype or defrecord. An already required namespace now gets the alias or refer added to its libspec, which cider-ns-add-require benefits from as well: requiring a namespace that's there without an alias adds the alias instead of reporting it as required. One with only :as-alias doesn't load the namespace, so a new libspec goes next to it. What can't work is an error rather than a silent no-op: a second alias for a namespace, or a refer of a name another libspec already refers. The request checks for cider/resolve-missing itself rather than going through the usual fallback to unprefixed op names, as refactor-nrepl answers resolve-missing in a different format. When the op fails, that's an error rather than finding nothing.
cider-ns-add-missing needs its cider/resolve-missing op.
bbatsov
force-pushed
the
ns-add-missing
branch
from
October 24, 2026 09:01
e4e20d1 to
9f496cc
Compare
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.
This replaces
cljr-add-missing-libspec, using thecider/resolve-missingop from clojure-emacs/cider-nrepl#1056.cider-ns-add-requirenow also adds a missing alias to a namespace that's already required, instead of reporting it as required. It builds on #4216, whose commit shows up here until that one merges.