clojure-emacs / cider-nrepl

A collection of nREPL middleware to enhance Clojure editors with common functionality like definition lookup, code completion, etc.
https://docs.cider.mx/cider-nrepl
677 stars 176 forks source link

Fix the debugger in case of a local shadows a var #847

Closed darkleaf closed 7 months ago

darkleaf commented 8 months ago

Fixes #846

Before submitting a PR make sure the following things have been done:

Note: If you're just starting out to hack on cider-nrepl you might find nREPL's documentation and the "Design" section of the README extremely useful.*

Thanks!


  1. resolve have an extra arity for &env
  2. I added arity for looks-step-innable? for backwards compatibility
(defn ns-resolve
  "Returns the var or Class to which a symbol will be resolved in the
  namespace (unless found in the environment), else nil.  Note that
  if the symbol is fully qualified, the var/Class to which it resolves
  need not be present in the namespace."
  {:added "1.0"
   :static true}
  ([ns sym]
    (ns-resolve ns nil sym))
  ([ns env sym]
    (when-not (contains? env sym)
      (clojure.lang.Compiler/maybeResolveIn (the-ns ns) sym))))

(defn resolve
  "same as (ns-resolve *ns* symbol) or (ns-resolve *ns* &env symbol)"
  {:added "1.0"
   :static true}
  ([sym] (ns-resolve *ns* sym))
  ([env sym] (ns-resolve *ns* env sym)))
vemv commented 8 months ago

Nice fix, thanks much!

I will merge it. First, please:

Cheers - V

darkleaf commented 8 months ago
Снимок экрана 2024-02-04 в 22 07 40
bbatsov commented 7 months ago

The changes look good to me. @vemv did you by any chance forgot to revisit this PR?

vemv commented 7 months ago

@darkleaf have you been testing out this changes locally in the meantime?

darkleaf commented 7 months ago

@darkleaf have you been testing out this changes locally in the meantime?

Yes

vemv commented 7 months ago

Awesome - thank you!

PR LGTM after addressing @bbatsov 's feedback

vemv commented 7 months ago

Thanks much!

There should be a release within the next few days.