Skip to content

Show locals table at each step in debugger #1106

@AdamClements

Description

@AdamClements

Rather than simply showing the last form return value, use the contents of &env to display a table of all the local bindings at a given point, as discussed with @Malabarba in gitter.

(defmacro locals [] (zipmap (map #(list 'quote %) (keys &env)) (keys &env)))

This will likely include some autogenerated locals (for destructuring, macros, etc.). These aren't likely to be too distracting, but a simple heuristic of whether a name consists of an underscore #[_] should filter out all of these (maybe have a toggle?)

(defn remove-autogenerated-locals
  "Remove any locals generated by macros (heuristic - named something
  with underscores in it). When we're doing something other than
  println with the data, these could be left in but it's a bit noisy
  at the moment"
  [coll]
  (into {} (remove (fn [[k v]] (re-find  #"[_]" (name k))) coll)))

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions